summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Kramkowski <tomasz@kramkow.ski>2024-12-04 16:23:26 +0000
committerTomasz Kramkowski <tomasz@kramkow.ski>2024-12-04 16:23:26 +0000
commit5194c5e8e68af015cb64f5653372fc8874a97cb4 (patch)
treeef94dba9b7bb8d0325607c5eadf626581b059a83
parent6543c06d5ccd34363d5e44eae6f565756fd1de68 (diff)
downloadaoc2024-5194c5e8e68af015cb64f5653372fc8874a97cb4.tar.gz
aoc2024-5194c5e8e68af015cb64f5653372fc8874a97cb4.tar.xz
aoc2024-5194c5e8e68af015cb64f5653372fc8874a97cb4.zip
Day 2 - clippy fixes
-rw-r--r--src/bin/2.rs10
1 files 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<dyn Error>> {
@@ -91,7 +91,7 @@ fn main() -> Result<(), Box<dyn Error>> {
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(())
}