From 74b430a4987152222ea943bbc31d2159ddbfb679 Mon Sep 17 00:00:00 2001 From: mos Date: Thu, 10 Oct 2024 15:18:46 +0200 Subject: [PATCH] replace neg with sub --- src/lib.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 13e123f..da7e71a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,5 @@ use rayon::prelude::*; -use std::ops::{Add, Index, IndexMut, Neg}; +use std::ops::{Add, Index, IndexMut, Sub}; pub enum ReadError { BadSymbol, @@ -49,11 +49,11 @@ impl Add for Pos { } } -impl Neg for Pos { +impl Sub for Pos { type Output = Self; - fn neg(self) -> Self { - Self(-self.0, -self.1) + fn sub(self, other: Self) -> Self { + Self(self.0 - other.0, self.1 - other.1) } } @@ -251,7 +251,7 @@ impl State { for i in dir { match self.lvl[pos + *i] { Cell::Goal(false) | Cell::None => { - let dpos = pos + -*i; + let dpos = pos - *i; match self.lvl[dpos] { Cell::Goal(false) | Cell::None => mbc += 1,