Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/liballoc/collections/binary_heap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1177,9 +1177,7 @@ impl<T: Ord> BinaryHeap<T> {

self.reserve(lower);

for elem in iterator {
self.push(elem);
}
iterator.for_each(move |elem| self.push(elem));
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/liballoc/collections/btree/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1727,9 +1727,9 @@ impl<K: Ord, V> FromIterator<(K, V)> for BTreeMap<K, V> {
impl<K: Ord, V> Extend<(K, V)> for BTreeMap<K, V> {
#[inline]
fn extend<T: IntoIterator<Item = (K, V)>>(&mut self, iter: T) {
for (k, v) in iter {
iter.into_iter().for_each(move |(k, v)| {
self.insert(k, v);
}
});
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/liballoc/collections/btree/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -883,9 +883,9 @@ impl<'a, T> IntoIterator for &'a BTreeSet<T> {
impl<T: Ord> Extend<T> for BTreeSet<T> {
#[inline]
fn extend<Iter: IntoIterator<Item = T>>(&mut self, iter: Iter) {
for elem in iter {
iter.into_iter().for_each(move |elem| {
self.insert(elem);
}
});
}
}

Expand Down
4 changes: 1 addition & 3 deletions src/liballoc/collections/linked_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1107,9 +1107,7 @@ impl<T> Extend<T> for LinkedList<T> {

impl<I: IntoIterator> SpecExtend<I> for LinkedList<I::Item> {
default fn spec_extend(&mut self, iter: I) {
for elt in iter {
self.push_back(elt);
}
iter.into_iter().for_each(move |elt| self.push_back(elt));
}
}

Expand Down
4 changes: 1 addition & 3 deletions src/liballoc/collections/vec_deque.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2677,9 +2677,7 @@ impl<'a, T> IntoIterator for &'a mut VecDeque<T> {
#[stable(feature = "rust1", since = "1.0.0")]
impl<A> Extend<A> for VecDeque<A> {
fn extend<T: IntoIterator<Item = A>>(&mut self, iter: T) {
for elt in iter {
self.push_back(elt);
}
iter.into_iter().for_each(move |elt| self.push_back(elt));
}
}

Expand Down
4 changes: 1 addition & 3 deletions src/libproc_macro/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,7 @@ impl iter::FromIterator<TokenTree> for TokenStream {
impl iter::FromIterator<TokenStream> for TokenStream {
fn from_iter<I: IntoIterator<Item = TokenStream>>(streams: I) -> Self {
let mut builder = bridge::client::TokenStreamBuilder::new();
for stream in streams {
builder.push(stream.0);
}
streams.into_iter().for_each(|stream| builder.push(stream.0));
TokenStream(builder.build())
}
}
Expand Down
4 changes: 1 addition & 3 deletions src/libstd/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1551,9 +1551,7 @@ impl<P: AsRef<Path>> iter::FromIterator<P> for PathBuf {
#[stable(feature = "rust1", since = "1.0.0")]
impl<P: AsRef<Path>> iter::Extend<P> for PathBuf {
fn extend<I: IntoIterator<Item = P>>(&mut self, iter: I) {
for p in iter {
self.push(p.as_ref())
}
iter.into_iter().for_each(move |p| self.push(p.as_ref()));
}
}

Expand Down
4 changes: 1 addition & 3 deletions src/libstd/sys_common/wtf8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,9 +388,7 @@ impl Extend<CodePoint> for Wtf8Buf {
let (low, _high) = iterator.size_hint();
// Lower bound of one byte per code point (ASCII only)
self.bytes.reserve(low);
for code_point in iterator {
self.push(code_point);
}
iterator.for_each(move |code_point| self.push(code_point));
}
}

Expand Down