diff options
| author | marisa <mokou@posteo.de> | 2019-11-11 16:51:38 +0100 |
|---|---|---|
| committer | marisa <mokou@posteo.de> | 2019-11-11 16:51:38 +0100 |
| commit | 9bdb0a12e45a8e9f9f6a4bd4a9c172c5376c7f60 (patch) | |
| tree | 3c4a094d57ecedf9706e0ba567a9f157590177c8 /exercises/error_handling/errors2.rs | |
| parent | 627cdc07d07dfe6a740e885e0ddf6900e7ec336b (diff) | |
feat: Refactor hint system
Hints are now accessible using the CLI subcommand `rustlings hint
<exercise name`.
BREAKING CHANGE: This fundamentally changes the way people interact with exercises.
Diffstat (limited to 'exercises/error_handling/errors2.rs')
| -rw-r--r-- | exercises/error_handling/errors2.rs | 26 |
1 files changed, 1 insertions, 25 deletions
diff --git a/exercises/error_handling/errors2.rs b/exercises/error_handling/errors2.rs index 8b81207..5ac6339 100644 --- a/exercises/error_handling/errors2.rs +++ b/exercises/error_handling/errors2.rs @@ -14,7 +14,7 @@ // and add. // There are at least two ways to implement this that are both correct-- but -// one is a lot shorter! Scroll down for hints to both ways. +// one is a lot shorter! Execute `rustlings hint errors2` for hints to both ways. use std::num::ParseIntError; @@ -43,27 +43,3 @@ 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 `?` 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/book/ch09-02-recoverable-errors-with-result.html#a-shortcut-for-propagating-errors-the--operator -// and give it a try! |
