replace neg with sub

This commit is contained in:
mos 2024-10-10 15:18:46 +02:00
parent 23547f1626
commit 74b430a498
1 changed files with 5 additions and 5 deletions

View File

@ -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,