mirror of
https://github.com/ArthurDanjou/rustlings.git
synced 2026-01-24 08:40:26 +01:00
Fix error_handling examples to use the ? operator
This commit is contained in:
@@ -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!
|
||||
|
||||
Reference in New Issue
Block a user