Rollup merge of #104056 - ripytide:patch-1, r=Mark-Simulacrum

Vec: IntoIterator signature consistency

Also makes the code dryer.
This commit is contained in:
Yuki Okushi 2022-11-07 09:46:26 +09:00 committed by GitHub
commit 57daec5989
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2780,7 +2780,7 @@ impl<T, A: Allocator> IntoIterator for Vec<T, A> {
/// assert_eq!(v_iter.next(), None);
/// ```
#[inline]
fn into_iter(self) -> IntoIter<T, A> {
fn into_iter(self) -> Self::IntoIter {
unsafe {
let mut me = ManuallyDrop::new(self);
let alloc = ManuallyDrop::new(ptr::read(me.allocator()));
@ -2808,7 +2808,7 @@ impl<'a, T, A: Allocator> IntoIterator for &'a Vec<T, A> {
type Item = &'a T;
type IntoIter = slice::Iter<'a, T>;
fn into_iter(self) -> slice::Iter<'a, T> {
fn into_iter(self) -> Self::IntoIter {
self.iter()
}
}
@ -2818,7 +2818,7 @@ impl<'a, T, A: Allocator> IntoIterator for &'a mut Vec<T, A> {
type Item = &'a mut T;
type IntoIter = slice::IterMut<'a, T>;
fn into_iter(self) -> slice::IterMut<'a, T> {
fn into_iter(self) -> Self::IntoIter {
self.iter_mut()
}
}