Skip to content

Commit 2a5aa2e

Browse files
committed
idiomatic collect() in map.rs
1 parent b76c44d commit 2a5aa2e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/map.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ pub fn map_into<T1: Ord, T2: Ord>(
77
output: &Variable<T2>,
88
mut logic: impl FnMut(&T1)->T2) {
99

10-
let mut results = Vec::new();
11-
let recent = input.recent.borrow();
12-
for tuple in recent.iter() {
13-
results.push(logic(tuple));
14-
}
10+
let results: Vec<T2> = input.recent
11+
.borrow()
12+
.into_iter()
13+
.map(|tuple| logic(tuple))
14+
.collect();
1515

1616
output.insert(Relation::from_vec(results));
1717
}

0 commit comments

Comments
 (0)