Skip to content

Commit 955de12

Browse files
committed
Change filtermap test to use sum instead of fold
1 parent 9fe771d commit 955de12

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/iter/plumbing/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ a very simple consumer because it doesn't need to thread any state
7070
between items at all.)
7171

7272
Now, the `for_each` call will pass this consumer to the base iterator,
73-
which is the `flat_map`. It will do by calling the `drive_unindexed`
73+
which is the `flat_map`. It will do this by calling the `drive_unindexed`
7474
method on the `ParallelIterator` trait. `drive_unindexed` basically
7575
says "produce items for this iterator and feed them to this consumer";
7676
it only works for unindexed consumers.

src/iter/test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@ pub fn check_sum_filtermap_ints() {
845845
let seq_sum_evens = a
846846
.iter()
847847
.filter_map(|&x| if (x & 1) == 0 { Some(x as f32) } else { None })
848-
.fold(0.0, |a, b| a + b);
848+
.sum();
849849
assert_eq!(par_sum_evens, seq_sum_evens);
850850
}
851851

@@ -2104,4 +2104,4 @@ fn check_update() {
21042104
v.par_iter_mut().update(|v| v.push(0)).for_each(|_| ());
21052105

21062106
assert_eq!(v, vec![vec![1, 0], vec![3, 2, 1, 0]]);
2107-
}
2107+
}

0 commit comments

Comments
 (0)