Skip to content

Commit

Permalink
One dimension does not need isize anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
ephemient committed Dec 4, 2024
1 parent d4f6cef commit d992bd9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rs/src/day4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ pub fn part1(data: &str) -> usize {
.iter()
.filter_map(move |(dx, dy)| {
try_from_fn(|i| {
y.checked_add_signed(i as isize * dy)
.and_then(|y| lines.get(y))
lines
.get(y + i * dy)
.zip(x.checked_add_signed(i as isize * dx))
.and_then(|(line, x)| line.as_bytes().get(x).copied())
})
Expand Down

0 comments on commit d992bd9

Please sign in to comment.