mirror of
https://github.com/notohh/rustlings.git
synced 2024-11-22 05:52:23 -05:00
Merge pull request #2022 from matthewjnield/main
chore: Update errors5.rs exercise to be consistent with solution
This commit is contained in:
commit
c9017f9f7a
1 changed files with 1 additions and 1 deletions
|
@ -39,8 +39,8 @@ struct PositiveNonzeroInteger(u64);
|
||||||
impl PositiveNonzeroInteger {
|
impl PositiveNonzeroInteger {
|
||||||
fn new(value: i64) -> Result<PositiveNonzeroInteger, CreationError> {
|
fn new(value: i64) -> Result<PositiveNonzeroInteger, CreationError> {
|
||||||
match value {
|
match value {
|
||||||
0 => Err(CreationError::Zero),
|
|
||||||
x if x < 0 => Err(CreationError::Negative),
|
x if x < 0 => Err(CreationError::Negative),
|
||||||
|
0 => Err(CreationError::Zero),
|
||||||
x => Ok(PositiveNonzeroInteger(x as u64)),
|
x => Ok(PositiveNonzeroInteger(x as u64)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue