Skip to content

Commit 9ff421d

Browse files
committed
Remove redundant bounds on get_unchecked for vec_deque iterators, and run fmt
1 parent f9c982c commit 9ff421d

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

library/alloc/src/collections/vec_deque/iter.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,8 @@ impl<'a, T> Iterator for Iter<'a, T> {
104104

105105
#[inline]
106106
#[doc(hidden)]
107-
unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> Self::Item
108-
where
109-
Self: TrustedRandomAccess,
110-
{
111-
// Safety: The TrustedRandomAccess contract requires that callers only pass an index
107+
unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> Self::Item {
108+
// Safety: The TrustedRandomAccess contract requires that callers only pass an index
112109
// that is in bounds.
113110
unsafe {
114111
let idx = wrap_index(self.tail.wrapping_add(idx), self.ring.len());

library/alloc/src/collections/vec_deque/iter_mut.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,8 @@ impl<'a, T> Iterator for IterMut<'a, T> {
9090

9191
#[inline]
9292
#[doc(hidden)]
93-
unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> Self::Item
94-
where
95-
Self: TrustedRandomAccess,
96-
{
97-
// Safety: The TrustedRandomAccess contract requires that callers only pass an index
93+
unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> Self::Item {
94+
// Safety: The TrustedRandomAccess contract requires that callers only pass an index
9895
// that is in bounds.
9996
unsafe {
10097
let idx = wrap_index(self.tail.wrapping_add(idx), self.ring.len());

library/alloc/src/vec/into_iter.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ use crate::alloc::{Allocator, Global};
22
use crate::raw_vec::RawVec;
33
use core::fmt;
44
use core::intrinsics::arith_offset;
5-
use core::iter::{FusedIterator, InPlaceIterable, SourceIter, TrustedLen, TrustedRandomAccessNoCoerce};
5+
use core::iter::{
6+
FusedIterator, InPlaceIterable, SourceIter, TrustedLen, TrustedRandomAccessNoCoerce,
7+
};
68
use core::marker::PhantomData;
79
use core::mem::{self};
810
use core::ptr::{self, NonNull};

0 commit comments

Comments
 (0)