@@ -641,7 +641,7 @@ impl<A: Array> SmallVec<A> {
641641 }
642642 let ( ptr, len_ptr, _) = self . triple_mut ( ) ;
643643 * len_ptr = len + 1 ;
644- ptr:: write ( ptr. offset ( len as isize ) , value) ;
644+ ptr:: write ( ptr. add ( len) , value) ;
645645 }
646646 }
647647
@@ -655,7 +655,7 @@ impl<A: Array> SmallVec<A> {
655655 }
656656 let last_index = * len_ptr - 1 ;
657657 * len_ptr = last_index;
658- Some ( ptr:: read ( ptr. offset ( last_index as isize ) ) )
658+ Some ( ptr:: read ( ptr. add ( last_index) ) )
659659 }
660660 }
661661
@@ -761,7 +761,7 @@ impl<A: Array> SmallVec<A> {
761761 while len < * len_ptr {
762762 let last_index = * len_ptr - 1 ;
763763 * len_ptr = last_index;
764- ptr:: drop_in_place ( ptr. offset ( last_index as isize ) ) ;
764+ ptr:: drop_in_place ( ptr. add ( last_index) ) ;
765765 }
766766 }
767767 }
@@ -809,7 +809,7 @@ impl<A: Array> SmallVec<A> {
809809 let len = * len_ptr;
810810 assert ! ( index < len) ;
811811 * len_ptr = len - 1 ;
812- ptr = ptr. offset ( index as isize ) ;
812+ ptr = ptr. add ( index) ;
813813 let item = ptr:: read ( ptr) ;
814814 ptr:: copy ( ptr. offset ( 1 ) , ptr, len - index - 1 ) ;
815815 item
@@ -827,7 +827,7 @@ impl<A: Array> SmallVec<A> {
827827 let len = * len_ptr;
828828 assert ! ( index <= len) ;
829829 * len_ptr = len + 1 ;
830- ptr = ptr. offset ( index as isize ) ;
830+ ptr = ptr. add ( index) ;
831831 ptr:: copy ( ptr, ptr. offset ( 1 ) , len - index) ;
832832 ptr:: write ( ptr, element) ;
833833 }
@@ -849,22 +849,22 @@ impl<A: Array> SmallVec<A> {
849849 unsafe {
850850 let old_len = self . len ( ) ;
851851 assert ! ( index <= old_len) ;
852- let mut ptr = self . as_mut_ptr ( ) . offset ( index as isize ) ;
852+ let mut ptr = self . as_mut_ptr ( ) . add ( index) ;
853853
854854 // Move the trailing elements.
855- ptr:: copy ( ptr, ptr. offset ( lower_size_bound as isize ) , old_len - index) ;
855+ ptr:: copy ( ptr, ptr. add ( lower_size_bound) , old_len - index) ;
856856
857857 // In case the iterator panics, don't double-drop the items we just copied above.
858858 self . set_len ( index) ;
859859
860860 let mut num_added = 0 ;
861861 for element in iter {
862- let mut cur = ptr. offset ( num_added as isize ) ;
862+ let mut cur = ptr. add ( num_added) ;
863863 if num_added >= lower_size_bound {
864864 // Iterator provided more elements than the hint. Move trailing items again.
865865 self . reserve ( 1 ) ;
866- ptr = self . as_mut_ptr ( ) . offset ( index as isize ) ;
867- cur = ptr. offset ( num_added as isize ) ;
866+ ptr = self . as_mut_ptr ( ) . add ( index) ;
867+ cur = ptr. add ( num_added) ;
868868 ptr:: copy ( cur, cur. offset ( 1 ) , old_len - index) ;
869869 }
870870 ptr:: write ( cur, element) ;
@@ -873,8 +873,8 @@ impl<A: Array> SmallVec<A> {
873873 if num_added < lower_size_bound {
874874 // Iterator provided fewer elements than the hint
875875 ptr:: copy (
876- ptr. offset ( lower_size_bound as isize ) ,
877- ptr. offset ( num_added as isize ) ,
876+ ptr. add ( lower_size_bound) ,
877+ ptr. add ( num_added) ,
878878 old_len - index,
879879 ) ;
880880 }
@@ -957,8 +957,8 @@ impl<A: Array> SmallVec<A> {
957957
958958 unsafe {
959959 for r in 1 ..len {
960- let p_r = ptr. offset ( r as isize ) ;
961- let p_wm1 = ptr. offset ( ( w - 1 ) as isize ) ;
960+ let p_r = ptr. add ( r ) ;
961+ let p_wm1 = ptr. add ( w - 1 ) ;
962962 if !same_bucket ( & mut * p_r, & mut * p_wm1) {
963963 if r != w {
964964 let p_w = p_wm1. offset ( 1 ) ;
@@ -1103,8 +1103,8 @@ where
11031103
11041104 unsafe {
11051105 let slice_ptr = slice. as_ptr ( ) ;
1106- let ptr = self . as_mut_ptr ( ) . offset ( index as isize ) ;
1107- ptr:: copy ( ptr, ptr. offset ( slice. len ( ) as isize ) , len - index) ;
1106+ let ptr = self . as_mut_ptr ( ) . add ( index) ;
1107+ ptr:: copy ( ptr, ptr. add ( slice. len ( ) ) , len - index) ;
11081108 ptr:: copy_nonoverlapping ( slice_ptr, ptr, slice. len ( ) ) ;
11091109 self . set_len ( len + slice. len ( ) ) ;
11101110 }
@@ -1318,7 +1318,7 @@ where
13181318 #[ cfg( not( feature = "specialization" ) ) ]
13191319 #[ inline]
13201320 fn from ( slice : & ' a [ A :: Item ] ) -> SmallVec < A > {
1321- slice. into_iter ( ) . cloned ( ) . collect ( )
1321+ slice. iter ( ) . cloned ( ) . collect ( )
13221322 }
13231323
13241324 #[ cfg( feature = "specialization" ) ]
@@ -1384,7 +1384,7 @@ impl<A: Array> Extend<A::Item> for SmallVec<A> {
13841384 let mut len = SetLenOnDrop :: new ( len_ptr) ;
13851385 while len. get ( ) < cap {
13861386 if let Some ( out) = iter. next ( ) {
1387- ptr:: write ( ptr. offset ( len. get ( ) as isize ) , out) ;
1387+ ptr:: write ( ptr. add ( len. get ( ) ) , out) ;
13881388 len. increment_len ( 1 ) ;
13891389 } else {
13901390 return ;
@@ -1463,10 +1463,6 @@ where
14631463 fn eq ( & self , other : & SmallVec < B > ) -> bool {
14641464 self [ ..] == other[ ..]
14651465 }
1466- #[ inline]
1467- fn ne ( & self , other : & SmallVec < B > ) -> bool {
1468- self [ ..] != other[ ..]
1469- }
14701466}
14711467
14721468impl < A : Array > Eq for SmallVec < A > where A :: Item : Eq { }
@@ -1550,7 +1546,7 @@ impl<A: Array> DoubleEndedIterator for IntoIter<A> {
15501546 } else {
15511547 unsafe {
15521548 self . end -= 1 ;
1553- Some ( ptr:: read ( self . data . as_ptr ( ) . offset ( self . end as isize ) ) )
1549+ Some ( ptr:: read ( self . data . as_ptr ( ) . add ( self . end ) ) )
15541550 }
15551551 }
15561552 }
@@ -1613,7 +1609,7 @@ impl<'a> SetLenOnDrop<'a> {
16131609 fn new ( len : & ' a mut usize ) -> Self {
16141610 SetLenOnDrop {
16151611 local_len : * len,
1616- len : len ,
1612+ len,
16171613 }
16181614 }
16191615
@@ -1649,7 +1645,7 @@ macro_rules! impl_array(
16491645impl_array ! (
16501646 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 20 , 24 , 32 , 36 , 0x40 , 0x60 , 0x80 ,
16511647 0x100 , 0x200 , 0x400 , 0x600 , 0x800 , 0x1000 , 0x2000 , 0x4000 , 0x6000 , 0x8000 , 0x10000 , 0x20000 ,
1652- 0x40000 , 0x60000 , 0x80000 , 0x100000
1648+ 0x40000 , 0x60000 , 0x80000 , 0x10_0000
16531649) ;
16541650
16551651#[ cfg( test) ]
0 commit comments