Fix the unstable book to account for ok-wrapping
This commit is contained in:
parent
aeb2353df5
commit
c88efe46b8
1 changed files with 4 additions and 4 deletions
|
@ -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());
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue