From 5ff762dacfee15a917bcde6bd251928145a37fad Mon Sep 17 00:00:00 2001 From: Daniel Lin Date: Tue, 19 Dec 2023 13:30:54 -0500 Subject: [PATCH] Remove panic!() --- rs/src/day19.rs | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/rs/src/day19.rs b/rs/src/day19.rs index 34f3a544..b2e6a5d5 100644 --- a/rs/src/day19.rs +++ b/rs/src/day19.rs @@ -150,16 +150,13 @@ fn part2_helper(rules: &HashMap<&str, Rule>, name: &str, bounds: Point<(u32, u32 else { return Some(0); }; - match ordering { - Ordering::Less => { - *hi0 = min(*hi0, value - 1); - *lo1 = max(*lo1, value); - } - Ordering::Greater => { - *lo0 = max(*lo0, value + 1); - *hi1 = min(*hi1, value); - } - Ordering::Equal => panic!(), + if ordering < Ordering::Greater { + *hi0 = min(*hi0, value - 1); + *lo1 = max(*lo1, value); + } + if ordering > Ordering::Less { + *lo0 = max(*lo0, value + 1); + *hi1 = min(*hi1, value); } if lo1 > hi1 { *st = None;