We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
set_from
zip
1 parent 1131899 commit 01e2062Copy full SHA for 01e2062
src/lib.rs
@@ -2222,15 +2222,10 @@ pub trait Itertools: Iterator {
2222
Self: Iterator<Item = &'a mut A>,
2223
J: IntoIterator<Item = A>,
2224
{
2225
- let mut count = 0;
2226
- for elt in from {
2227
- match self.next() {
2228
- None => break,
2229
- Some(ptr) => *ptr = elt,
2230
- }
2231
- count += 1;
2232
2233
- count
+ from.into_iter()
+ .zip(self)
+ .map(|(new, old)| *old = new)
+ .count()
2234
}
2235
2236
/// Combine all iterator elements into one String, separated by `sep`.
0 commit comments