heh
Diffstat (limited to 'src/util.rs')
-rw-r--r--src/util.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/util.rs b/src/util.rs
index b3efe19..4fbb7a9 100644
--- a/src/util.rs
+++ b/src/util.rs
@@ -549,14 +549,14 @@ impl std::ops::Add<(i16, i16)> for Dir {
}
impl std::ops::Add<(u8, u8)> for Dir {
- type Output = Option<(u8, u8)>;
+ type Output = (u8, u8);
fn add(self, (x, y): (u8, u8)) -> Self::Output {
match self {
- Dir::N => Some((x, y.checked_sub(1)?)),
- Dir::E => Some((x + 1, y)),
- Dir::S => Some((x, y + 1)),
- Dir::W => Some((x.checked_sub(1)?, y)),
+ Dir::N => (x, y.wrapping_sub(1)),
+ Dir::E => (x.wrapping_add(1), y),
+ Dir::S => (x, y.wrapping_add(1)),
+ Dir::W => (x.wrapping_sub(1), y),
}
}
}