From b87aa986345cd80bc44c7fe7bffeb72f5fe0ddb5 Mon Sep 17 00:00:00 2001 From: mo8it Date: Thu, 4 Jul 2024 13:38:35 +0200 Subject: Fix warnings --- exercises/13_error_handling/errors4.rs | 2 ++ exercises/13_error_handling/errors6.rs | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'exercises/13_error_handling') diff --git a/exercises/13_error_handling/errors4.rs b/exercises/13_error_handling/errors4.rs index ba01e54..e41d594 100644 --- a/exercises/13_error_handling/errors4.rs +++ b/exercises/13_error_handling/errors4.rs @@ -1,3 +1,5 @@ +#![allow(clippy::comparison_chain)] + #[derive(PartialEq, Debug)] enum CreationError { Negative, diff --git a/exercises/13_error_handling/errors6.rs b/exercises/13_error_handling/errors6.rs index 0652abd..b656c61 100644 --- a/exercises/13_error_handling/errors6.rs +++ b/exercises/13_error_handling/errors6.rs @@ -35,7 +35,7 @@ impl PositiveNonzeroInteger { fn new(value: i64) -> Result { 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() { -- cgit v1.2.3