File tree Expand file tree Collapse file tree 1 file changed +14
-18
lines changed Expand file tree Collapse file tree 1 file changed +14
-18
lines changed Original file line number Diff line number Diff line change @@ -2697,25 +2697,21 @@ impl<T> Iterator for IntoIter<T> {
26972697
26982698 #[ inline]
26992699 fn next ( & mut self ) -> Option < T > {
2700- unsafe {
2701- if self . ptr as * const _ == self . end {
2702- None
2703- } else {
2704- if mem:: size_of :: < T > ( ) == 0 {
2705- // purposefully don't use 'ptr.offset' because for
2706- // vectors with 0-size elements this would return the
2707- // same pointer.
2708- self . ptr = arith_offset ( self . ptr as * const T , 1 ) as * mut T ;
2709-
2710- // Make up a value of this ZST.
2711- Some ( mem:: zeroed ( ) )
2712- } else {
2713- let old = self . ptr ;
2714- self . ptr = self . ptr . offset ( 1 ) ;
2700+ if self . ptr as * const _ == self . end {
2701+ None
2702+ } else if mem:: size_of :: < T > ( ) == 0 {
2703+ // purposefully don't use 'ptr.offset' because for
2704+ // vectors with 0-size elements this would return the
2705+ // same pointer.
2706+ self . ptr = unsafe { arith_offset ( self . ptr as * const T , 1 ) as * mut T } ;
2707+
2708+ // Make up a value of this ZST.
2709+ Some ( unsafe { mem:: zeroed ( ) } )
2710+ } else {
2711+ let old = self . ptr ;
2712+ self . ptr = unsafe { self . ptr . offset ( 1 ) } ;
27152713
2716- Some ( ptr:: read ( old) )
2717- }
2718- }
2714+ Some ( unsafe { ptr:: read ( old) } )
27192715 }
27202716 }
27212717
You can’t perform that action at this time.
0 commit comments