replace neg with sub
This commit is contained in:
parent
23547f1626
commit
74b430a498
10
src/lib.rs
10
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,
|
||||
|
|
Loading…
Reference in New Issue