From 0000033015d963f6d0470358fda8ed0e569c9469 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Jane=C5=BEi=C4=8D?= Date: Fri, 9 Dec 2022 19:47:58 +0100 Subject: [PATCH] chore: clippy --- src/bin/15.rs | 4 ++-- src/bin/17.rs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/bin/15.rs b/src/bin/15.rs index e38f8d8..f32e37c 100644 --- a/src/bin/15.rs +++ b/src/bin/15.rs @@ -137,11 +137,11 @@ mod tests { #[test] fn test_part_one() { let input = aoc::read_file("test_inputs", 15); - assert_eq!(part_one(&input.trim()), Some(62842880)); + assert_eq!(part_one(input.trim()), Some(62842880)); } #[test] fn test_part_two() { let input = aoc::read_file("test_inputs", 15); - assert_eq!(part_two(&input.trim()), Some(57600000)); + assert_eq!(part_two(input.trim()), Some(57600000)); } } diff --git a/src/bin/17.rs b/src/bin/17.rs index 3d8a1b5..6586167 100644 --- a/src/bin/17.rs +++ b/src/bin/17.rs @@ -9,7 +9,7 @@ pub fn part_one(input: &str) -> Option { containers .iter() .combinations(x) - .map(|y| y.iter().map(|w| *w).sum::()) + .map(|y| y.iter().copied().sum::()) .filter(|&z| z == 150) .count() }) @@ -23,12 +23,12 @@ pub fn part_two(input: &str) -> Option { containers .iter() .combinations(x) - .map(|y| (y.len(), y.iter().map(|w| *w).sum::())) + .map(|y| (y.len(), y.iter().copied().sum::())) .filter(|(_, z)| z == &150) .map(|(t, _)| t) .collect_vec() }) - .filter(|x| x.len() > 0) + .filter(|x| !x.is_empty()) .map(|x| { let m = x.iter().min().unwrap(); (*m, x.iter().filter(|&y| y == m).count())