Fix error_handling examples to use the ? operator

This commit is contained in:
Hynek Schlawack
2018-03-06 15:57:41 +01:00
parent 65bedf2d90
commit 3182b4d9ec
4 changed files with 21 additions and 26 deletions

View File

@@ -66,7 +66,7 @@ mod tests {
// One way to handle this is using a `match` statement on
// `item_quantity.parse::<i32>()` where the cases are `Ok(something)` and
// `Err(something)`. This pattern is very common in Rust, though, so there's
// a `try!` macro that does pretty much what you would make that match statement
// a `?` operator that does pretty much what you would make that match statement
// do for you! Take a look at this section of the Error Handling chapter:
// https://doc.rust-lang.org/stable/book/error-handling.html#the-try-macro
// and give it a `try!`
// https://doc.rust-lang.org/book/second-edition/ch09-02-recoverable-errors-with-result.html#a-shortcut-for-propagating-errors-
// and give it a try!