Skip to content

Commit 90642a9

Browse files
committed
functional
1 parent aaac26a commit 90642a9

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/node_table.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -419,13 +419,10 @@ impl NodeTable {
419419
&self,
420420
mut f: impl FnMut(&crate::NodeTableRow) -> bool,
421421
) -> Vec<NodeId> {
422-
let mut samples: Vec<NodeId> = vec![];
423-
for row in self.iter() {
424-
if f(&row) {
425-
samples.push(row.id);
426-
}
427-
}
428-
samples
422+
self.iter()
423+
.filter(|row| f(row))
424+
.map(|row| row.id)
425+
.collect::<Vec<_>>()
429426
}
430427
}
431428

0 commit comments

Comments
 (0)