Skip to content

Commit

Permalink
Rollup merge of #61726 - cuviper:partition-for_each, r=scottmcm
Browse files Browse the repository at this point in the history
Use `for_each` in `Iterator::partition`

We already use this for `unzip`, but `partition` is not much different.
  • Loading branch information
Centril committed Jun 11, 2019
2 parents e294c42 + c127f53 commit 5837b9f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/libcore/iter/traits/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1495,13 +1495,13 @@ pub trait Iterator {
let mut left: B = Default::default();
let mut right: B = Default::default();

for x in self {
self.for_each(|x| {
if f(&x) {
left.extend(Some(x))
} else {
right.extend(Some(x))
}
}
});

(left, right)
}
Expand Down

0 comments on commit 5837b9f

Please sign in to comment.