From c0db09910d9d512dae2cc73645003ddd223d14a9 Mon Sep 17 00:00:00 2001 From: mirsella Date: Thu, 5 Dec 2024 08:23:01 +0100 Subject: [PATCH] use unwrap_or_default --- 2024/day5/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2024/day5/src/main.rs b/2024/day5/src/main.rs index 13ca94b..410dcae 100644 --- a/2024/day5/src/main.rs +++ b/2024/day5/src/main.rs @@ -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()