mirror of
https://github.com/bertptrs/adventofcode.git
synced 2025-12-26 13:20:32 +01:00
Forgot to add sample, simplyfiy match
This commit is contained in:
@@ -50,12 +50,7 @@ impl<'a> Index<usize> for Grid<'a> {
|
||||
|
||||
fn is_surrounded(grid: &Grid<'_>, y: usize, start: usize, last: usize) -> bool {
|
||||
fn is_symbol(c: u8) -> bool {
|
||||
match c {
|
||||
b'0'..=b'9' => false,
|
||||
b'.' => false,
|
||||
b'\n' => false,
|
||||
_ => true,
|
||||
}
|
||||
!matches!(c, b'0'..=b'9' | b'.' | b'\n')
|
||||
}
|
||||
let x_min = start.saturating_sub(1);
|
||||
let x_max = Ord::min(grid.width(), last + 2);
|
||||
|
||||
Reference in New Issue
Block a user