Remove redundant bounds on get_unchecked for vec_deque iterators, and run fmt
This commit is contained in:
parent
f9c982c8fd
commit
9ff421da99
3 changed files with 7 additions and 11 deletions
|
|
@ -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());
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
|
|
|||
|
|
@ -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};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue