1
0
mirror of https://github.com/rust-lang/rustlings.git synced 2025-08-10 22:42:13 +02:00

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.
This commit is contained in:
Taylor Yu
2021-06-09 18:13:57 -05:00
parent 68d3ac567c
commit b7ddd09fab
3 changed files with 35 additions and 23 deletions

View File

@@ -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)
}