chore: clippy
This commit is contained in:
parent
0000032005
commit
0000033015
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ pub fn part_one(input: &str) -> Option<u32> {
|
|||
containers
|
||||
.iter()
|
||||
.combinations(x)
|
||||
.map(|y| y.iter().map(|w| *w).sum::<u32>())
|
||||
.map(|y| y.iter().copied().sum::<u32>())
|
||||
.filter(|&z| z == 150)
|
||||
.count()
|
||||
})
|
||||
|
@ -23,12 +23,12 @@ pub fn part_two(input: &str) -> Option<u32> {
|
|||
containers
|
||||
.iter()
|
||||
.combinations(x)
|
||||
.map(|y| (y.len(), y.iter().map(|w| *w).sum::<u32>()))
|
||||
.map(|y| (y.len(), y.iter().copied().sum::<u32>()))
|
||||
.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())
|
||||
|
|
Loading…
Reference in New Issue