Skip to content

Commit

Permalink
2023-03: Replace filter, map with filter_map
Browse files Browse the repository at this point in the history
  • Loading branch information
MLNW committed Dec 3, 2023
1 parent 57acb34 commit 339685d
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions 2023-rust/src/bin/03.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ pub fn part_one(input: &str) -> Option<u32> {

parts
.iter()
.filter(|part| part.neighboring_symbol(&symbols).is_some())
.map(|part| part.number)
.filter_map(|part| part.neighboring_symbol(&symbols).map(|_| part.number))
.reduce(|acc, number| acc + number)
}

Expand Down

0 comments on commit 339685d

Please sign in to comment.