We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a9919e0 commit 91984e7Copy full SHA for 91984e7
library/alloc/src/vec.rs
@@ -2955,24 +2955,11 @@ impl<T> Iterator for IntoIter<T> {
2955
unsafe {
2956
if mem::size_of::<T>() == 0 { mem::zeroed() } else { ptr::read(self.ptr.add(i)) }
2957
}
2958
+ }
2959
+
2960
#[inline]
2961
fn last(mut self) -> Option<T> {
- unsafe {
- if self.ptr as *const _ == self.end {
2962
- None
2963
- } else {
2964
- if mem::size_of::<T>() == 0 {
2965
- // Immediately marches to end of the iterator.
2966
- self.ptr = self.end;
2967
- // Make up a value of this ZST.
2968
- Some(mem::zeroed())
2969
2970
2971
2972
- Some(ptr::read(self.ptr.offset(-1)))
2973
- }
2974
2975
+ self.next_back()
2976
2977
2978
0 commit comments