reduce constant index

This commit is contained in:
2025-02-19 21:21:23 -05:00
parent 846dfc8b4c
commit 31f80c0d6f

View File

@@ -101,7 +101,10 @@ impl FutureMoves {
pub fn extend_layers(&mut self) { pub fn extend_layers(&mut self) {
let mut next_nodes: Vec<usize> = (0..self.arena.len()) let mut next_nodes: Vec<usize> = (0..self.arena.len())
// we want to select all nodes that don't have children, or are lazy (need to maybe be regenerated) // we want to select all nodes that don't have children, or are lazy (need to maybe be regenerated)
.filter(|&idx| self.arena[idx].children.is_empty() || self.arena[idx].lazy_children) .filter(|&idx| {
let got = &self.arena[idx];
got.lazy_children || got.children.is_empty()
})
.filter(|&idx| self.is_connected_to_root(idx)) // put here so this will not extend needlessly before prunes .filter(|&idx| self.is_connected_to_root(idx)) // put here so this will not extend needlessly before prunes
.collect(); .collect();