Use for_each
in Iterator::partition
We already use this for `unzip`, but `partition` is not much different.
This commit is contained in:
parent
02564de47b
commit
c127f537e9
1 changed files with 2 additions and 2 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue