From 5194c5e8e68af015cb64f5653372fc8874a97cb4 Mon Sep 17 00:00:00 2001 From: Tomasz Kramkowski Date: Wed, 4 Dec 2024 16:23:26 +0000 Subject: Day 2 - clippy fixes --- src/bin/2.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/bin/2.rs b/src/bin/2.rs index a674c9a..1f13ba7 100644 --- a/src/bin/2.rs +++ b/src/bin/2.rs @@ -29,7 +29,7 @@ impl Dir { Self::Ascending => b - a, Self::Descending => a - b, }; - diff >= 1 && diff <= 3 + (1..=3).contains(&diff) } } @@ -45,7 +45,7 @@ fn p1cond(report: &[i16]) -> bool { return false; } } - return true; + true } fn p2cond(report: &[i16]) -> bool { @@ -74,7 +74,7 @@ fn p2cond(report: &[i16]) -> bool { } return true; } - return false; + false } fn main() -> Result<(), Box> { @@ -91,7 +91,7 @@ fn main() -> Result<(), Box> { input.push(elems); } let input = input.into_boxed_slice(); - println!("{}", input.iter().filter(|e| p1cond(*e)).count()); - println!("{}", input.iter().filter(|e| p2cond(*e)).count()); + println!("{}", input.iter().filter(|e| p1cond(e)).count()); + println!("{}", input.iter().filter(|e| p2cond(e)).count()); Ok(()) } -- cgit v1.2.3-54-g00ecf