]> git.lizzy.rs Git - rust.git/commitdiff
trpl: Fix example logic in error handling chapter
authorBoris Egorov <egorov@linux.com>
Wed, 25 Nov 2015 07:59:21 +0000 (13:59 +0600)
committerBoris Egorov <egorov@linux.com>
Wed, 25 Nov 2015 08:07:43 +0000 (14:07 +0600)
src/doc/book/error-handling.md

index e37360a457b7b6bd5a1937fc42c5815a5a7d499d..af6846e65de67ec66945d33b75ee543e31485d7f 100644 (file)
@@ -681,6 +681,7 @@ fn double_arg(mut argv: env::Args) -> Result<i32, String> {
     argv.nth(1)
         .ok_or("Please give at least one argument".to_owned())
         .and_then(|arg| arg.parse::<i32>().map_err(|err| err.to_string()))
+        .map(|n| 2 * n)
 }
 
 fn main() {