Remove array::IntoIter::with_partial
-- an artifact of the past, once used to create an IntoIter
from its parts
This commit is contained in:
parent
f5485181ca
commit
ef72349e38
@ -84,16 +84,6 @@ impl<T, const N: usize> IntoIter<T, N> {
|
||||
IntoIterator::into_iter(array)
|
||||
}
|
||||
|
||||
/// Creates a new iterator from a partially initalized array.
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// The caller must guarantee that all and only the `alive` elements of
|
||||
/// `data` are initialized.
|
||||
pub(crate) unsafe fn with_partial(data: [MaybeUninit<T>; N], alive: Range<usize>) -> Self {
|
||||
Self { data, alive }
|
||||
}
|
||||
|
||||
/// Creates an iterator over the elements in a partially-initialized buffer.
|
||||
///
|
||||
/// If you have a fully-initialized array, then use [`IntoIterator`].
|
||||
|
@ -64,7 +64,7 @@ fn next(&mut self) -> Option<Self::Item> {
|
||||
mem::forget(guard);
|
||||
self.remainder = {
|
||||
// SAFETY: `array` was initialized with `init` elements.
|
||||
Some(unsafe { array::IntoIter::with_partial(array, 0..init) })
|
||||
Some(unsafe { array::IntoIter::new_unchecked(array, 0..init) })
|
||||
};
|
||||
}
|
||||
return None;
|
||||
@ -124,7 +124,8 @@ fn try_fold<B, F, R>(&mut self, init: B, mut f: F) -> R
|
||||
let init = guard.init;
|
||||
mem::forget(guard);
|
||||
// SAFETY: `array` was initialized with `init` elements.
|
||||
self.remainder = Some(unsafe { array::IntoIter::with_partial(array, 0..init) });
|
||||
self.remainder =
|
||||
Some(unsafe { array::IntoIter::new_unchecked(array, 0..init) });
|
||||
}
|
||||
R::from_output(o)
|
||||
}
|
||||
@ -305,7 +306,7 @@ fn next_back_remainder(&mut self) -> Option<()> {
|
||||
// SAFETY: `array` was initialized with exactly `init` elements.
|
||||
self.remainder = unsafe {
|
||||
array.get_unchecked_mut(..init).reverse();
|
||||
Some(array::IntoIter::with_partial(array, 0..init))
|
||||
Some(array::IntoIter::new_unchecked(array, 0..init))
|
||||
};
|
||||
Some(())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user