fix lints in fish
This commit is contained in:
parent
e673198704
commit
a9b86e03c4
|
@ -210,8 +210,8 @@ impl SegmentedAStar {
|
||||||
trans: &mut TransTable,
|
trans: &mut TransTable,
|
||||||
eval: &Evaluator,
|
eval: &Evaluator,
|
||||||
) -> Result<u32, Option<&'a Node>> {
|
) -> Result<u32, Option<&'a Node>> {
|
||||||
let open_set = self.open.get_mut(self.depth);
|
let open_set = self.open.get_mut(self.depth).ok_or(None)?;
|
||||||
let cand = open_set.map_or(None, |set| set.pop()).ok_or(None)?;
|
let cand = open_set.pop().ok_or(None)?;
|
||||||
let cand = unsafe { cand.0.as_node() };
|
let cand = unsafe { cand.0.as_node() };
|
||||||
|
|
||||||
if cand.is_terminal() {
|
if cand.is_terminal() {
|
||||||
|
@ -230,9 +230,8 @@ impl SegmentedAStar {
|
||||||
eval.evaluate(mat, queue)
|
eval.evaluate(mat, queue)
|
||||||
};
|
};
|
||||||
|
|
||||||
for suc in cand.expand(arena, trans, evaluate) {
|
let expanded = cand.expand(arena, trans, evaluate);
|
||||||
self.open[self.depth].push(suc.into());
|
self.open[self.depth].extend(expanded.map(AStarNode::from));
|
||||||
}
|
|
||||||
|
|
||||||
Ok(work)
|
Ok(work)
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ fn copy_matrix<'a>(arena: &'a Arena, matrix: &Mat) -> &'a Mat {
|
||||||
fn copy_queue<'a>(arena: &'a Arena, queue: Queue<'_>) -> Queue<'a> {
|
fn copy_queue<'a>(arena: &'a Arena, queue: Queue<'_>) -> Queue<'a> {
|
||||||
Queue {
|
Queue {
|
||||||
hold: queue.hold,
|
hold: queue.hold,
|
||||||
next: arena.alloc_slice_copy(&queue.next),
|
next: arena.alloc_slice_copy(queue.next),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
||||||
|
use core::mem::replace;
|
||||||
use core::ops::Range;
|
use core::ops::Range;
|
||||||
use mino::matrix::{EMPTY_ROW, FULL_ROW};
|
use mino::matrix::{EMPTY_ROW, FULL_ROW};
|
||||||
use mino::{Mat, MatBuf};
|
use mino::{Mat, MatBuf};
|
||||||
|
@ -125,18 +126,17 @@ fn flood_fill(rows: &mut [u16]) -> Option<(i16, i16, u32)> {
|
||||||
(lx, rx)
|
(lx, rx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// list the new columns that should be passed on the stack for the given row and range
|
// list the new columns that should be pushed on the stack for the given row and range
|
||||||
fn scan(row: u16, lx: i16, rx: i16) -> impl Iterator<Item = i16> {
|
fn scan(row: u16, lx: i16, rx: i16) -> impl Iterator<Item = i16> {
|
||||||
let mut added = false;
|
let mut allowed = true;
|
||||||
(lx..rx).filter_map(move |x| {
|
(lx..rx).filter(move |x| {
|
||||||
if row & (1 << x) != 0 {
|
if row & (1 << x) != 0 {
|
||||||
added = false;
|
// don't push this column since it is occupied, but push the next
|
||||||
None
|
// unoccupied column encountered
|
||||||
} else if added {
|
allowed = true;
|
||||||
None
|
false
|
||||||
} else {
|
} else {
|
||||||
added = true;
|
replace(&mut allowed, false)
|
||||||
Some(x)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue