File tree 2 files changed +2
-24
lines changed
2 files changed +2
-24
lines changed Original file line number Diff line number Diff line change @@ -2082,13 +2082,7 @@ impl<'a, T> IntoIterator for &'a mut Vec<T> {
2082
2082
impl < T > Extend < T > for Vec < T > {
2083
2083
#[ inline]
2084
2084
fn extend < I : IntoIterator < Item = T > > ( & mut self , iter : I ) {
2085
- if self . capacity ( ) > 0 {
2086
- <Self as SpecExtend < T , I :: IntoIter > >:: spec_extend ( self , iter. into_iter ( ) )
2087
- } else {
2088
- // if self has no allocation then use the more powerful from_iter specializations
2089
- // and overwrite self
2090
- * self = SpecFrom :: from_iter ( iter. into_iter ( ) ) ;
2091
- }
2085
+ <Self as SpecExtend < T , I :: IntoIter > >:: spec_extend ( self , iter. into_iter ( ) )
2092
2086
}
2093
2087
2094
2088
#[ inline]
@@ -2544,13 +2538,7 @@ impl<T> Vec<T> {
2544
2538
#[ stable( feature = "extend_ref" , since = "1.2.0" ) ]
2545
2539
impl < ' a , T : ' a + Copy > Extend < & ' a T > for Vec < T > {
2546
2540
fn extend < I : IntoIterator < Item = & ' a T > > ( & mut self , iter : I ) {
2547
- if self . capacity ( ) > 0 {
2548
- self . spec_extend ( iter. into_iter ( ) )
2549
- } else {
2550
- // if self has no allocation then use the more powerful from_iter specializations
2551
- // and overwrite self
2552
- * self = SpecFrom :: from_iter ( iter. into_iter ( ) ) ;
2553
- }
2541
+ self . spec_extend ( iter. into_iter ( ) )
2554
2542
}
2555
2543
2556
2544
#[ inline]
Original file line number Diff line number Diff line change @@ -798,16 +798,6 @@ fn test_from_iter_partially_drained_in_place_specialization() {
798
798
assert_eq ! ( srcptr, sinkptr) ;
799
799
}
800
800
801
- #[ test]
802
- fn test_extend_in_place_specialization ( ) {
803
- let src: Vec < usize > = vec ! [ 0usize ; 1 ] ;
804
- let srcptr = src. as_ptr ( ) ;
805
- let mut dst = Vec :: new ( ) ;
806
- dst. extend ( src. into_iter ( ) ) ;
807
- let dstptr = dst. as_ptr ( ) ;
808
- assert_eq ! ( srcptr, dstptr) ;
809
- }
810
-
811
801
#[ test]
812
802
fn test_from_iter_specialization_with_iterator_adapters ( ) {
813
803
fn assert_in_place_trait < T : InPlaceIterable > ( _: & T ) { } ;
You can’t perform that action at this time.
0 commit comments