Skip to content

Commit

Permalink
Inline dim function
Browse files Browse the repository at this point in the history
jeffs committed Dec 11, 2023
1 parent 7eb06a2 commit 7c66959
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions 2023/day11/src/lib.rs
Original file line number Diff line number Diff line change
@@ -63,12 +63,8 @@ impl Grid {
self.0.first().map(|row| row.len()).unwrap_or_default()
}

fn dim(&self) -> (usize, usize) {
(self.height(), self.width())
}

fn enumerate(&self) -> impl Iterator<Item = (Position, Tile)> + '_ {
let (h, w) = self.dim();
let (h, w) = (self.height(), self.width());
(0..h)
.flat_map(move |i| (0..w).map(move |j| Position(i, j)))
.map(|p| (p, self.0[p.0][p.1]))

0 comments on commit 7c66959

Please sign in to comment.