diff options
| author | mo8it <mo8it@proton.me> | 2024-07-04 13:38:35 +0200 |
|---|---|---|
| committer | mo8it <mo8it@proton.me> | 2024-07-04 13:38:35 +0200 |
| commit | b87aa986345cd80bc44c7fe7bffeb72f5fe0ddb5 (patch) | |
| tree | b9f2400168cfba69cb3f0914e337df2436843023 /solutions/13_error_handling | |
| parent | a4c07ca948dd57c71fe1894d05308af03304dec8 (diff) | |
Fix warnings
Diffstat (limited to 'solutions/13_error_handling')
| -rw-r--r-- | solutions/13_error_handling/errors2.rs | 1 | ||||
| -rw-r--r-- | solutions/13_error_handling/errors4.rs | 2 | ||||
| -rw-r--r-- | solutions/13_error_handling/errors6.rs | 3 |
3 files changed, 4 insertions, 2 deletions
diff --git a/solutions/13_error_handling/errors2.rs b/solutions/13_error_handling/errors2.rs index f652ecb..0597c8c 100644 --- a/solutions/13_error_handling/errors2.rs +++ b/solutions/13_error_handling/errors2.rs @@ -16,6 +16,7 @@ use std::num::ParseIntError; +#[allow(unused_variables)] fn total_cost(item_quantity: &str) -> Result<i32, ParseIntError> { let processing_fee = 1; let cost_per_item = 5; diff --git a/solutions/13_error_handling/errors4.rs b/solutions/13_error_handling/errors4.rs index c43f493..f4d39bf 100644 --- a/solutions/13_error_handling/errors4.rs +++ b/solutions/13_error_handling/errors4.rs @@ -1,3 +1,5 @@ +#![allow(clippy::comparison_chain)] + #[derive(PartialEq, Debug)] enum CreationError { Negative, diff --git a/solutions/13_error_handling/errors6.rs b/solutions/13_error_handling/errors6.rs index 70680cf..429d3ea 100644 --- a/solutions/13_error_handling/errors6.rs +++ b/solutions/13_error_handling/errors6.rs @@ -36,7 +36,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)), } } @@ -57,7 +57,6 @@ fn main() { #[cfg(test)] mod test { use super::*; - use std::num::IntErrorKind; #[test] fn test_parse_error() { |
