mirror of
https://github.com/notohh/rustlings.git
synced 2025-07-15 11:45:34 -04:00
Fix warnings
This commit is contained in:
parent
a4c07ca948
commit
b87aa98634
18 changed files with 28 additions and 8 deletions
exercises/13_error_handling
|
@ -1,3 +1,5 @@
|
|||
#![allow(clippy::comparison_chain)]
|
||||
|
||||
#[derive(PartialEq, Debug)]
|
||||
enum CreationError {
|
||||
Negative,
|
||||
|
|
|
@ -35,7 +35,7 @@ impl PositiveNonzeroInteger {
|
|||
fn new(value: i64) -> Result<Self, CreationError> {
|
||||
match value {
|
||||
x if x < 0 => Err(CreationError::Negative),
|
||||
x if x == 0 => Err(CreationError::Zero),
|
||||
0 => Err(CreationError::Zero),
|
||||
x => Ok(Self(x as u64)),
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,6 @@ fn main() {
|
|||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use std::num::IntErrorKind;
|
||||
|
||||
#[test]
|
||||
fn test_parse_error() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue