Skip to content

Commit

Permalink
use unwrap_or_default
Browse files Browse the repository at this point in the history
  • Loading branch information
mirsella committed Dec 5, 2024
1 parent a81daf2 commit c0db099
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion 2024/day5/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ fn part1(input: &str) -> usize {
updates
.filter_map(|update| {
update
.is_sorted_by(|a, b| ordering.get(b).map(|v| v.contains(a)).unwrap_or(false))
.is_sorted_by(|a, b| ordering.get(b).map(|v| v.contains(a)).unwrap_or_default())
.then_some(update[update.len() / 2])
})
.sum()
Expand Down

0 comments on commit c0db099

Please sign in to comment.