diff options
| author | Frank Steffahn <frank.steffahn@stu.uni-kiel.de> | 2021-07-01 19:04:50 +0200 |
|---|---|---|
| committer | Frank Steffahn <frank.steffahn@stu.uni-kiel.de> | 2021-07-28 14:33:36 +0200 |
| commit | 9ff421da992d6612eb43fb58014f83ce15168146 (patch) | |
| tree | de480777314f9e9f4a8ff3b8b5b5874e98438c0e /library/alloc/src | |
| parent | f9c982c8fd4984e1b3751f883291ba52256edc1c (diff) | |
| download | rust-9ff421da992d6612eb43fb58014f83ce15168146.tar.gz rust-9ff421da992d6612eb43fb58014f83ce15168146.zip | |
Remove redundant bounds on get_unchecked for vec_deque iterators, and run fmt
Diffstat (limited to 'library/alloc/src')
| -rw-r--r-- | library/alloc/src/collections/vec_deque/iter.rs | 7 | ||||
| -rw-r--r-- | library/alloc/src/collections/vec_deque/iter_mut.rs | 7 | ||||
| -rw-r--r-- | library/alloc/src/vec/into_iter.rs | 4 |
3 files changed, 7 insertions, 11 deletions
diff --git a/library/alloc/src/collections/vec_deque/iter.rs b/library/alloc/src/collections/vec_deque/iter.rs index 3fa5bb6bff0..edadd666edc 100644 --- a/library/alloc/src/collections/vec_deque/iter.rs +++ b/library/alloc/src/collections/vec_deque/iter.rs @@ -104,11 +104,8 @@ impl<'a, T> Iterator for Iter<'a, T> { #[inline] #[doc(hidden)] - unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> Self::Item - where - Self: TrustedRandomAccess, - { - // Safety: The TrustedRandomAccess contract requires that callers only pass an index + unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> Self::Item { + // Safety: The TrustedRandomAccess contract requires that callers only pass an index // that is in bounds. unsafe { let idx = wrap_index(self.tail.wrapping_add(idx), self.ring.len()); diff --git a/library/alloc/src/collections/vec_deque/iter_mut.rs b/library/alloc/src/collections/vec_deque/iter_mut.rs index 5974d480cf0..7700b31cf5b 100644 --- a/library/alloc/src/collections/vec_deque/iter_mut.rs +++ b/library/alloc/src/collections/vec_deque/iter_mut.rs @@ -90,11 +90,8 @@ impl<'a, T> Iterator for IterMut<'a, T> { #[inline] #[doc(hidden)] - unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> Self::Item - where - Self: TrustedRandomAccess, - { - // Safety: The TrustedRandomAccess contract requires that callers only pass an index + unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> Self::Item { + // Safety: The TrustedRandomAccess contract requires that callers only pass an index // that is in bounds. unsafe { let idx = wrap_index(self.tail.wrapping_add(idx), self.ring.len()); diff --git a/library/alloc/src/vec/into_iter.rs b/library/alloc/src/vec/into_iter.rs index 89a8330b234..0bd152f17a6 100644 --- a/library/alloc/src/vec/into_iter.rs +++ b/library/alloc/src/vec/into_iter.rs @@ -2,7 +2,9 @@ use crate::alloc::{Allocator, Global}; use crate::raw_vec::RawVec; use core::fmt; use core::intrinsics::arith_offset; -use core::iter::{FusedIterator, InPlaceIterable, SourceIter, TrustedLen, TrustedRandomAccessNoCoerce}; +use core::iter::{ + FusedIterator, InPlaceIterable, SourceIter, TrustedLen, TrustedRandomAccessNoCoerce, +}; use core::marker::PhantomData; use core::mem::{self}; use core::ptr::{self, NonNull}; |
