Skip to content

Commit 0d6bb9d

Browse files
committed
Canonicalize special cases of map (2) specialize collect on MapSpecialCase
1 parent be65c2e commit 0d6bb9d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/adaptors/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,13 @@ impl<I, R> Iterator for MapSpecialCase<I, R>
863863
let mut f = self.f;
864864
self.iter.fold(init, move |acc, v| fold_f(acc, f.call(v)))
865865
}
866+
867+
fn collect<C>(self) -> C
868+
where C: FromIterator<Self::Item>
869+
{
870+
let mut f = self.f;
871+
self.iter.map(move |v| f.call(v)).collect()
872+
}
866873
}
867874

868875
impl<I, R> DoubleEndedIterator for MapSpecialCase<I, R>

0 commit comments

Comments
 (0)