1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-11-30 09:08:45 +02:00

More minor fixes (#1561)

- Fix compile errors and warnings in error handling example
- Tweak iteration example so that it correctly visits the first grid
coordinate
This commit is contained in:
Marshall Pierce
2023-12-06 10:53:06 -07:00
committed by GitHub
parent 857511a763
commit 9efad3212f
2 changed files with 7 additions and 6 deletions

View File

@@ -34,7 +34,6 @@ impl Iterator for GridIter {
type Item = (u32, u32);
fn next(&mut self) -> Option<(u32, u32)> {
self.i += 1;
if self.i >= self.grid.x_coords.len() {
self.i = 0;
self.j += 1;
@@ -42,7 +41,9 @@ impl Iterator for GridIter {
return None;
}
}
Some((self.grid.x_coords[self.i], self.grid.y_coords[self.j]))
let res = Some((self.grid.x_coords[self.i], self.grid.y_coords[self.j]));
self.i += 1;
res
}
}