1
0
Fork 0
mirror of https://github.com/notohh/rustlings.git synced 2025-08-10 05:13:17 -04:00

Fix warnings

This commit is contained in:
mo8it 2024-07-04 13:38:35 +02:00
commit b87aa98634
18 changed files with 28 additions and 8 deletions
solutions/13_error_handling

View file

@ -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;

View file

@ -1,3 +1,5 @@
#![allow(clippy::comparison_chain)]
#[derive(PartialEq, Debug)]
enum CreationError {
Negative,

View file

@ -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() {