mirror of
https://github.com/bertptrs/adventofcode.git
synced 2025-12-25 21:00:31 +01:00
Replace filter + map with filter_map.
This commit is contained in:
@@ -42,8 +42,7 @@ fn total2(items: &[usize]) -> (usize, usize) {
|
||||
}
|
||||
|
||||
let total = items[start..(start + meta_entries)].iter()
|
||||
.filter(|&&x| x <= values.len())
|
||||
.map(|&x| values[x - 1])
|
||||
.filter_map(|&x| values.get(x - 1))
|
||||
.sum();
|
||||
|
||||
(total, start + meta_entries)
|
||||
|
||||
Reference in New Issue
Block a user