Skip to content

Commit 6e65939

Browse files
committed
rewriting (does not compile)
1 parent 8188d45 commit 6e65939

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/dfx/src/lib/graph/traverse_filtered.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@ impl<NodeId, VM> DfsFiltered<NodeId, VM> {
1515
}
1616
}
1717

18-
pub fn traverse<G, P, C, NodeWeight>(&mut self, graph: G, predicate: P, call: C)
18+
pub fn traverse<G, P, C, NodeWeight>(&mut self, graph: G, mut predicate: P, mut call: C)
1919
where C: Fn(&NodeId, &NodeId) -> (),
2020
G: IntoNeighbors<NodeId = NodeId> + DataMap<NodeWeight = NodeWeight>,
21-
P: Fn(&NodeId) -> bool,
21+
P: FnMut(&NodeId) -> bool,
2222
NodeId: Copy + PartialEq,
2323
VM: VisitMap<NodeId>,
2424
{
2525
while let Some(item) = &self.base.next(graph) {
26-
if predicate(item) {
27-
let parent = self.base.stack.iter().rev().find(predicate);
26+
if (&mut predicate)(item) {
27+
let parent = self.base.stack.iter().map(|e| *e).rev().find(&mut predicate);
2828
if let Some(parent) = &parent {
29-
call(parent, item);
29+
(&mut call)(parent, item);
3030
}
3131
}
3232
}

0 commit comments

Comments
 (0)