diff options
| author | Taylor Yu <tlyu@mit.edu> | 2021-06-09 18:13:57 -0500 |
|---|---|---|
| committer | Taylor Yu <tlyu@mit.edu> | 2021-06-09 23:27:53 -0500 |
| commit | b7ddd09fab97fc96f032bc8c0b9e1a64e5ffbcdd (patch) | |
| tree | 4f3109041b10c432405984c0f04a0c4a7fa092b3 /exercises/error_handling/errors5.rs | |
| parent | 68d3ac567cd5c23f5593c2f4df51612bca3d09a9 (diff) | |
address review feedback
Adjust error text and naming to conform with best practices.
Use `map_err()` instead of `or()`. Wrap lower-level errors instead of
ignoring their details.
Also, don't "cheat" by bypassing the `new()` function in tests.
Fix a dangling reference in the try_from_into hints.
Diffstat (limited to 'exercises/error_handling/errors5.rs')
| -rw-r--r-- | exercises/error_handling/errors5.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/exercises/error_handling/errors5.rs b/exercises/error_handling/errors5.rs index 1b11800..365a869 100644 --- a/exercises/error_handling/errors5.rs +++ b/exercises/error_handling/errors5.rs @@ -43,8 +43,8 @@ impl PositiveNonzeroInteger { impl fmt::Display for CreationError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let description = match *self { - CreationError::Negative => "Number is negative", - CreationError::Zero => "Number is zero", + CreationError::Negative => "number is negative", + CreationError::Zero => "number is zero", }; f.write_str(description) } |
