trpl: Fix example logic in error handling chapter

This commit is contained in:
Boris Egorov 2015-11-25 13:59:21 +06:00
parent 7fa2c6ca31
commit b892b5a690

View 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() {