1
Fork 0

Fix the unstable book to account for ok-wrapping

This commit is contained in:
Scott McMurray 2018-04-03 09:20:24 -07:00
parent aeb2353df5
commit c88efe46b8

View file

@ -15,16 +15,16 @@ expression creates a new scope one can use the `?` operator in.
use std::num::ParseIntError;
let result: Result<i32, ParseIntError> = do catch {
Ok("1".parse::<i32>()?
"1".parse::<i32>()?
+ "2".parse::<i32>()?
+ "3".parse::<i32>()?)
+ "3".parse::<i32>()?
};
assert_eq!(result, Ok(6));
let result: Result<i32, ParseIntError> = do catch {
Ok("1".parse::<i32>()?
"1".parse::<i32>()?
+ "foo".parse::<i32>()?
+ "3".parse::<i32>()?)
+ "3".parse::<i32>()?
};
assert!(result.is_err());
```