File tree Expand file tree Collapse file tree 2 files changed +2
-24
lines changed Expand file tree Collapse file tree 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> {
20822082impl < T > Extend < T > for Vec < T > {
20832083 #[ inline]
20842084 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 ( ) )
20922086 }
20932087
20942088 #[ inline]
@@ -2544,13 +2538,7 @@ impl<T> Vec<T> {
25442538#[ stable( feature = "extend_ref" , since = "1.2.0" ) ]
25452539impl < ' a , T : ' a + Copy > Extend < & ' a T > for Vec < T > {
25462540 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 ( ) )
25542542 }
25552543
25562544 #[ inline]
Original file line number Diff line number Diff line change @@ -798,16 +798,6 @@ fn test_from_iter_partially_drained_in_place_specialization() {
798798 assert_eq ! ( srcptr, sinkptr) ;
799799}
800800
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-
811801#[ test]
812802fn test_from_iter_specialization_with_iterator_adapters ( ) {
813803 fn assert_in_place_trait < T : InPlaceIterable > ( _: & T ) { } ;
You can’t perform that action at this time.
0 commit comments