Skip to content

Commit 5837b9f

Browse files
authored
Rollup merge of #61726 - cuviper:partition-for_each, r=scottmcm
Use `for_each` in `Iterator::partition` We already use this for `unzip`, but `partition` is not much different.
2 parents e294c42 + c127f53 commit 5837b9f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/libcore/iter/traits/iterator.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1495,13 +1495,13 @@ pub trait Iterator {
14951495
let mut left: B = Default::default();
14961496
let mut right: B = Default::default();
14971497

1498-
for x in self {
1498+
self.for_each(|x| {
14991499
if f(&x) {
15001500
left.extend(Some(x))
15011501
} else {
15021502
right.extend(Some(x))
15031503
}
1504-
}
1504+
});
15051505

15061506
(left, right)
15071507
}

0 commit comments

Comments
 (0)