Skip to content

Commit

Permalink
Remove panic!()
Browse files Browse the repository at this point in the history
  • Loading branch information
ephemient committed Dec 19, 2023
1 parent 6d29c8b commit 5ff762d
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions rs/src/day19.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 5ff762d

Please sign in to comment.