Skip to content

Commit 5dc9db5

Browse files
committed
vec: Remove the Vec specialization for .extend()
This now produces as good code (with optimizations) using the TrustedLen codepath.
1 parent 2411be5 commit 5dc9db5

File tree

1 file changed

+0
-13
lines changed

1 file changed

+0
-13
lines changed

src/libcollections/vec.rs

-13
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ use core::ptr;
7676
use core::ptr::Shared;
7777
use core::slice;
7878

79-
use super::SpecExtend;
8079
use super::range::RangeArgument;
8180

8281
/// A contiguous growable array type, written `Vec<T>` but pronounced 'vector.'
@@ -1554,22 +1553,10 @@ impl<'a, T> IntoIterator for &'a mut Vec<T> {
15541553
impl<T> Extend<T> for Vec<T> {
15551554
#[inline]
15561555
fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I) {
1557-
<Self as SpecExtend<I>>::spec_extend(self, iter);
1558-
}
1559-
}
1560-
1561-
impl<I: IntoIterator> SpecExtend<I> for Vec<I::Item> {
1562-
default fn spec_extend(&mut self, iter: I) {
15631556
self.extend_desugared(iter.into_iter())
15641557
}
15651558
}
15661559

1567-
impl<T> SpecExtend<Vec<T>> for Vec<T> {
1568-
fn spec_extend(&mut self, ref mut other: Vec<T>) {
1569-
self.append(other);
1570-
}
1571-
}
1572-
15731560
trait IsTrustedLen : Iterator {
15741561
fn trusted_len(&self) -> Option<usize> { None }
15751562
}

0 commit comments

Comments
 (0)