mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-28 09:44:08 +00:00
style: applying Rust style
This commit is contained in:
parent
6002b280f1
commit
2de8356f60
@ -1,7 +1,7 @@
|
|||||||
use crate::borrow::Cow;
|
use crate::borrow::Cow;
|
||||||
use core::iter::{FromIterator};
|
use core::iter::FromIterator;
|
||||||
|
|
||||||
use super::{Vec};
|
use super::Vec;
|
||||||
|
|
||||||
#[stable(feature = "cow_from_vec", since = "1.8.0")]
|
#[stable(feature = "cow_from_vec", since = "1.8.0")]
|
||||||
impl<'a, T: Clone> From<&'a [T]> for Cow<'a, [T]> {
|
impl<'a, T: Clone> From<&'a [T]> for Cow<'a, [T]> {
|
||||||
@ -26,8 +26,8 @@ impl<'a, T: Clone> From<&'a Vec<T>> for Cow<'a, [T]> {
|
|||||||
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
impl<'a, T> FromIterator<T> for Cow<'a, [T]>
|
impl<'a, T> FromIterator<T> for Cow<'a, [T]>
|
||||||
where
|
where
|
||||||
T: Clone,
|
T: Clone,
|
||||||
{
|
{
|
||||||
fn from_iter<I: IntoIterator<Item = T>>(it: I) -> Cow<'a, [T]> {
|
fn from_iter<I: IntoIterator<Item = T>>(it: I) -> Cow<'a, [T]> {
|
||||||
Cow::Owned(FromIterator::from_iter(it))
|
Cow::Owned(FromIterator::from_iter(it))
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
use crate::alloc::{Allocator, Global};
|
use crate::alloc::{Allocator, Global};
|
||||||
use core::iter::{
|
use core::fmt;
|
||||||
FusedIterator, TrustedLen,
|
use core::iter::{FusedIterator, TrustedLen};
|
||||||
};
|
|
||||||
use core::mem::{self};
|
use core::mem::{self};
|
||||||
use core::ptr::{self, NonNull};
|
use core::ptr::{self, NonNull};
|
||||||
use core::slice::{self};
|
use core::slice::{self};
|
||||||
use core::fmt;
|
|
||||||
|
|
||||||
use super::{Vec};
|
use super::Vec;
|
||||||
|
|
||||||
/// A draining iterator for `Vec<T>`.
|
/// A draining iterator for `Vec<T>`.
|
||||||
///
|
///
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
|
use crate::alloc::{Allocator, Global};
|
||||||
use core::ptr::{self};
|
use core::ptr::{self};
|
||||||
use core::slice::{self};
|
use core::slice::{self};
|
||||||
use crate::alloc::{Allocator, Global};
|
|
||||||
|
|
||||||
use super::{Vec};
|
use super::Vec;
|
||||||
|
|
||||||
/// An iterator which uses a closure to determine if an element should be removed.
|
/// An iterator which uses a closure to determine if an element should be removed.
|
||||||
///
|
///
|
||||||
@ -45,8 +45,8 @@ pub struct DrainFilter<
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<T, F, A: Allocator> DrainFilter<'_, T, F, A>
|
impl<T, F, A: Allocator> DrainFilter<'_, T, F, A>
|
||||||
where
|
where
|
||||||
F: FnMut(&mut T) -> bool,
|
F: FnMut(&mut T) -> bool,
|
||||||
{
|
{
|
||||||
/// Returns a reference to the underlying allocator.
|
/// Returns a reference to the underlying allocator.
|
||||||
#[unstable(feature = "allocator_api", issue = "32838")]
|
#[unstable(feature = "allocator_api", issue = "32838")]
|
||||||
@ -58,8 +58,8 @@ impl<T, F, A: Allocator> DrainFilter<'_, T, F, A>
|
|||||||
|
|
||||||
#[unstable(feature = "drain_filter", reason = "recently added", issue = "43244")]
|
#[unstable(feature = "drain_filter", reason = "recently added", issue = "43244")]
|
||||||
impl<T, F, A: Allocator> Iterator for DrainFilter<'_, T, F, A>
|
impl<T, F, A: Allocator> Iterator for DrainFilter<'_, T, F, A>
|
||||||
where
|
where
|
||||||
F: FnMut(&mut T) -> bool,
|
F: FnMut(&mut T) -> bool,
|
||||||
{
|
{
|
||||||
type Item = T;
|
type Item = T;
|
||||||
|
|
||||||
@ -96,20 +96,20 @@ impl<T, F, A: Allocator> Iterator for DrainFilter<'_, T, F, A>
|
|||||||
|
|
||||||
#[unstable(feature = "drain_filter", reason = "recently added", issue = "43244")]
|
#[unstable(feature = "drain_filter", reason = "recently added", issue = "43244")]
|
||||||
impl<T, F, A: Allocator> Drop for DrainFilter<'_, T, F, A>
|
impl<T, F, A: Allocator> Drop for DrainFilter<'_, T, F, A>
|
||||||
where
|
where
|
||||||
F: FnMut(&mut T) -> bool,
|
F: FnMut(&mut T) -> bool,
|
||||||
{
|
{
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
struct BackshiftOnDrop<'a, 'b, T, F, A: Allocator>
|
struct BackshiftOnDrop<'a, 'b, T, F, A: Allocator>
|
||||||
where
|
where
|
||||||
F: FnMut(&mut T) -> bool,
|
F: FnMut(&mut T) -> bool,
|
||||||
{
|
{
|
||||||
drain: &'b mut DrainFilter<'a, T, F, A>,
|
drain: &'b mut DrainFilter<'a, T, F, A>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b, T, F, A: Allocator> Drop for BackshiftOnDrop<'a, 'b, T, F, A>
|
impl<'a, 'b, T, F, A: Allocator> Drop for BackshiftOnDrop<'a, 'b, T, F, A>
|
||||||
where
|
where
|
||||||
F: FnMut(&mut T) -> bool,
|
F: FnMut(&mut T) -> bool,
|
||||||
{
|
{
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -3,9 +3,9 @@ use core::slice::{self};
|
|||||||
|
|
||||||
// A helper struct for in-place iteration that drops the destination slice of iteration,
|
// A helper struct for in-place iteration that drops the destination slice of iteration,
|
||||||
// i.e. the head. The source slice (the tail) is dropped by IntoIter.
|
// i.e. the head. The source slice (the tail) is dropped by IntoIter.
|
||||||
pub (super) struct InPlaceDrop<T> {
|
pub(super) struct InPlaceDrop<T> {
|
||||||
pub (super) inner: *mut T,
|
pub(super) inner: *mut T,
|
||||||
pub (super) dst: *mut T,
|
pub(super) dst: *mut T,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> InPlaceDrop<T> {
|
impl<T> InPlaceDrop<T> {
|
||||||
|
@ -1,14 +1,12 @@
|
|||||||
use crate::alloc::{Allocator, Global};
|
use crate::alloc::{Allocator, Global};
|
||||||
use crate::raw_vec::RawVec;
|
use crate::raw_vec::RawVec;
|
||||||
use core::marker::PhantomData;
|
|
||||||
use core::intrinsics::{arith_offset};
|
|
||||||
use core::mem::{self};
|
|
||||||
use core::fmt;
|
use core::fmt;
|
||||||
|
use core::intrinsics::arith_offset;
|
||||||
|
use core::iter::{FusedIterator, InPlaceIterable, SourceIter, TrustedLen, TrustedRandomAccess};
|
||||||
|
use core::marker::PhantomData;
|
||||||
|
use core::mem::{self};
|
||||||
use core::ptr::{self, NonNull};
|
use core::ptr::{self, NonNull};
|
||||||
use core::slice::{self};
|
use core::slice::{self};
|
||||||
use core::iter::{
|
|
||||||
FusedIterator, InPlaceIterable, SourceIter, TrustedLen, TrustedRandomAccess,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// An iterator that moves out of a vector.
|
/// An iterator that moves out of a vector.
|
||||||
///
|
///
|
||||||
@ -156,8 +154,8 @@ impl<T, A: Allocator> Iterator for IntoIter<T, A> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn __iterator_get_unchecked(&mut self, i: usize) -> Self::Item
|
unsafe fn __iterator_get_unchecked(&mut self, i: usize) -> Self::Item
|
||||||
where
|
where
|
||||||
Self: TrustedRandomAccess,
|
Self: TrustedRandomAccess,
|
||||||
{
|
{
|
||||||
// SAFETY: the caller must guarantee that `i` is in bounds of the
|
// SAFETY: the caller must guarantee that `i` is in bounds of the
|
||||||
// `Vec<T>`, so `i` cannot overflow an `isize`, and the `self.ptr.add(i)`
|
// `Vec<T>`, so `i` cannot overflow an `isize`, and the `self.ptr.add(i)`
|
||||||
@ -211,8 +209,8 @@ unsafe impl<T, A: Allocator> TrustedLen for IntoIter<T, A> {}
|
|||||||
// T: Copy as approximation for !Drop since get_unchecked does not advance self.ptr
|
// T: Copy as approximation for !Drop since get_unchecked does not advance self.ptr
|
||||||
// and thus we can't implement drop-handling
|
// and thus we can't implement drop-handling
|
||||||
unsafe impl<T, A: Allocator> TrustedRandomAccess for IntoIter<T, A>
|
unsafe impl<T, A: Allocator> TrustedRandomAccess for IntoIter<T, A>
|
||||||
where
|
where
|
||||||
T: Copy,
|
T: Copy,
|
||||||
{
|
{
|
||||||
fn may_have_side_effect() -> bool {
|
fn may_have_side_effect() -> bool {
|
||||||
false
|
false
|
||||||
|
@ -58,7 +58,7 @@ use core::convert::TryFrom;
|
|||||||
use core::fmt;
|
use core::fmt;
|
||||||
use core::hash::{Hash, Hasher};
|
use core::hash::{Hash, Hasher};
|
||||||
use core::intrinsics::{arith_offset, assume};
|
use core::intrinsics::{arith_offset, assume};
|
||||||
use core::iter::{FromIterator};
|
use core::iter::FromIterator;
|
||||||
use core::marker::PhantomData;
|
use core::marker::PhantomData;
|
||||||
use core::mem::{self, ManuallyDrop, MaybeUninit};
|
use core::mem::{self, ManuallyDrop, MaybeUninit};
|
||||||
use core::ops::{self, Index, IndexMut, Range, RangeBounds};
|
use core::ops::{self, Index, IndexMut, Range, RangeBounds};
|
||||||
@ -88,9 +88,9 @@ mod drain;
|
|||||||
|
|
||||||
mod cow;
|
mod cow;
|
||||||
|
|
||||||
|
pub(crate) use self::into_iter::AsIntoIter;
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
pub use self::into_iter::IntoIter;
|
pub use self::into_iter::IntoIter;
|
||||||
pub (crate) use self::into_iter::AsIntoIter;
|
|
||||||
|
|
||||||
mod into_iter;
|
mod into_iter;
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use crate::alloc::{Allocator};
|
use crate::alloc::Allocator;
|
||||||
use crate::borrow::Cow;
|
use crate::borrow::Cow;
|
||||||
|
|
||||||
use super::{Vec};
|
use super::Vec;
|
||||||
|
|
||||||
macro_rules! __impl_slice_eq1 {
|
macro_rules! __impl_slice_eq1 {
|
||||||
([$($vars:tt)*] $lhs:ty, $rhs:ty $(where $ty:ty: $bound:ident)?, #[$stability:meta]) => {
|
([$($vars:tt)*] $lhs:ty, $rhs:ty $(where $ty:ty: $bound:ident)?, #[$stability:meta]) => {
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
use core::iter::{
|
use core::iter::{InPlaceIterable, SourceIter};
|
||||||
InPlaceIterable, SourceIter,
|
|
||||||
};
|
|
||||||
use core::mem::{self, ManuallyDrop};
|
use core::mem::{self, ManuallyDrop};
|
||||||
use core::ptr::{self};
|
use core::ptr::{self};
|
||||||
|
|
||||||
use super::{Vec, InPlaceDrop, AsIntoIter, SpecFromIter, SpecFromIterNested};
|
use super::{AsIntoIter, InPlaceDrop, SpecFromIter, SpecFromIterNested, Vec};
|
||||||
|
|
||||||
/// Specialization marker for collecting an iterator pipeline into a Vec while reusing the
|
/// Specialization marker for collecting an iterator pipeline into a Vec while reusing the
|
||||||
/// source allocation, i.e. executing the pipeline in place.
|
/// source allocation, i.e. executing the pipeline in place.
|
||||||
@ -13,7 +11,7 @@ use super::{Vec, InPlaceDrop, AsIntoIter, SpecFromIter, SpecFromIterNested};
|
|||||||
/// which is to be reused. But it is not sufficient for the specialization to be valid. See
|
/// which is to be reused. But it is not sufficient for the specialization to be valid. See
|
||||||
/// additional bounds on the impl.
|
/// additional bounds on the impl.
|
||||||
#[rustc_unsafe_specialization_marker]
|
#[rustc_unsafe_specialization_marker]
|
||||||
pub (super) trait SourceIterMarker: SourceIter<Source: AsIntoIter> {}
|
pub(super) trait SourceIterMarker: SourceIter<Source: AsIntoIter> {}
|
||||||
|
|
||||||
// The std-internal SourceIter/InPlaceIterable traits are only implemented by chains of
|
// The std-internal SourceIter/InPlaceIterable traits are only implemented by chains of
|
||||||
// Adapter<Adapter<Adapter<IntoIter>>> (all owned by core/std). Additional bounds
|
// Adapter<Adapter<Adapter<IntoIter>>> (all owned by core/std). Additional bounds
|
||||||
@ -24,8 +22,8 @@ pub (super) trait SourceIterMarker: SourceIter<Source: AsIntoIter> {}
|
|||||||
impl<T> SourceIterMarker for T where T: SourceIter<Source: AsIntoIter> + InPlaceIterable {}
|
impl<T> SourceIterMarker for T where T: SourceIter<Source: AsIntoIter> + InPlaceIterable {}
|
||||||
|
|
||||||
impl<T, I> SpecFromIter<T, I> for Vec<T>
|
impl<T, I> SpecFromIter<T, I> for Vec<T>
|
||||||
where
|
where
|
||||||
I: Iterator<Item = T> + SourceIterMarker,
|
I: Iterator<Item = T> + SourceIterMarker,
|
||||||
{
|
{
|
||||||
default fn from_iter(mut iterator: I) -> Self {
|
default fn from_iter(mut iterator: I) -> Self {
|
||||||
// Additional requirements which cannot expressed via trait bounds. We rely on const eval
|
// Additional requirements which cannot expressed via trait bounds. We rely on const eval
|
||||||
@ -35,9 +33,9 @@ impl<T, I> SpecFromIter<T, I> for Vec<T>
|
|||||||
// c) alignments match as required by Alloc contract
|
// c) alignments match as required by Alloc contract
|
||||||
if mem::size_of::<T>() == 0
|
if mem::size_of::<T>() == 0
|
||||||
|| mem::size_of::<T>()
|
|| mem::size_of::<T>()
|
||||||
!= mem::size_of::<<<I as SourceIter>::Source as AsIntoIter>::Item>()
|
!= mem::size_of::<<<I as SourceIter>::Source as AsIntoIter>::Item>()
|
||||||
|| mem::align_of::<T>()
|
|| mem::align_of::<T>()
|
||||||
!= mem::align_of::<<<I as SourceIter>::Source as AsIntoIter>::Item>()
|
!= mem::align_of::<<<I as SourceIter>::Source as AsIntoIter>::Item>()
|
||||||
{
|
{
|
||||||
// fallback to more generic implementations
|
// fallback to more generic implementations
|
||||||
return SpecFromIterNested::from_iter(iterator);
|
return SpecFromIterNested::from_iter(iterator);
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
use crate::alloc::{Allocator};
|
use crate::alloc::Allocator;
|
||||||
use core::iter::{TrustedLen};
|
use core::iter::TrustedLen;
|
||||||
use core::slice::{self};
|
|
||||||
use core::ptr::{self};
|
use core::ptr::{self};
|
||||||
|
use core::slice::{self};
|
||||||
|
|
||||||
use super::{Vec, IntoIter, SetLenOnDrop};
|
use super::{IntoIter, SetLenOnDrop, Vec};
|
||||||
|
|
||||||
// Specialization trait used for Vec::extend
|
// Specialization trait used for Vec::extend
|
||||||
pub(super) trait SpecExtend<T, I> {
|
pub(super) trait SpecExtend<T, I> {
|
||||||
@ -11,8 +11,8 @@ pub(super) trait SpecExtend<T, I> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<T, I, A: Allocator> SpecExtend<T, I> for Vec<T, A>
|
impl<T, I, A: Allocator> SpecExtend<T, I> for Vec<T, A>
|
||||||
where
|
where
|
||||||
I: Iterator<Item = T>,
|
I: Iterator<Item = T>,
|
||||||
{
|
{
|
||||||
default fn spec_extend(&mut self, iter: I) {
|
default fn spec_extend(&mut self, iter: I) {
|
||||||
self.extend_desugared(iter)
|
self.extend_desugared(iter)
|
||||||
@ -20,8 +20,8 @@ impl<T, I, A: Allocator> SpecExtend<T, I> for Vec<T, A>
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<T, I, A: Allocator> SpecExtend<T, I> for Vec<T, A>
|
impl<T, I, A: Allocator> SpecExtend<T, I> for Vec<T, A>
|
||||||
where
|
where
|
||||||
I: TrustedLen<Item = T>,
|
I: TrustedLen<Item = T>,
|
||||||
{
|
{
|
||||||
default fn spec_extend(&mut self, iterator: I) {
|
default fn spec_extend(&mut self, iterator: I) {
|
||||||
// This is the case for a TrustedLen iterator.
|
// This is the case for a TrustedLen iterator.
|
||||||
@ -62,9 +62,9 @@ impl<T, A: Allocator> SpecExtend<T, IntoIter<T>> for Vec<T, A> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T: 'a, I, A: Allocator + 'a> SpecExtend<&'a T, I> for Vec<T, A>
|
impl<'a, T: 'a, I, A: Allocator + 'a> SpecExtend<&'a T, I> for Vec<T, A>
|
||||||
where
|
where
|
||||||
I: Iterator<Item = &'a T>,
|
I: Iterator<Item = &'a T>,
|
||||||
T: Clone,
|
T: Clone,
|
||||||
{
|
{
|
||||||
default fn spec_extend(&mut self, iterator: I) {
|
default fn spec_extend(&mut self, iterator: I) {
|
||||||
self.spec_extend(iterator.cloned())
|
self.spec_extend(iterator.cloned())
|
||||||
@ -72,8 +72,8 @@ impl<'a, T: 'a, I, A: Allocator + 'a> SpecExtend<&'a T, I> for Vec<T, A>
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T: 'a, A: Allocator + 'a> SpecExtend<&'a T, slice::Iter<'a, T>> for Vec<T, A>
|
impl<'a, T: 'a, A: Allocator + 'a> SpecExtend<&'a T, slice::Iter<'a, T>> for Vec<T, A>
|
||||||
where
|
where
|
||||||
T: Copy,
|
T: Copy,
|
||||||
{
|
{
|
||||||
fn spec_extend(&mut self, iterator: slice::Iter<'a, T>) {
|
fn spec_extend(&mut self, iterator: slice::Iter<'a, T>) {
|
||||||
let slice = iterator.as_slice();
|
let slice = iterator.as_slice();
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
use crate::alloc::{Allocator};
|
use crate::alloc::Allocator;
|
||||||
use crate::raw_vec::RawVec;
|
use crate::raw_vec::RawVec;
|
||||||
use core::ptr::{self};
|
use core::ptr::{self};
|
||||||
|
|
||||||
use super::{Vec, IsZero, ExtendElement};
|
use super::{ExtendElement, IsZero, Vec};
|
||||||
|
|
||||||
// Specialization trait used for Vec::from_elem
|
// Specialization trait used for Vec::from_elem
|
||||||
pub(super) trait SpecFromElem: Sized {
|
pub(super) trait SpecFromElem: Sized {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
use crate::alloc::Global;
|
use crate::alloc::Global;
|
||||||
use core::mem::{ManuallyDrop};
|
use core::mem::ManuallyDrop;
|
||||||
use core::ptr::{self};
|
use core::ptr::{self};
|
||||||
use core::slice::{self};
|
use core::slice::{self};
|
||||||
|
|
||||||
use super::{Vec, IntoIter, SpecFromIterNested, SpecExtend};
|
use super::{IntoIter, SpecExtend, SpecFromIterNested, Vec};
|
||||||
|
|
||||||
/// Specialization trait used for Vec::from_iter
|
/// Specialization trait used for Vec::from_iter
|
||||||
///
|
///
|
||||||
@ -30,8 +30,8 @@ pub(super) trait SpecFromIter<T, I> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<T, I> SpecFromIter<T, I> for Vec<T>
|
impl<T, I> SpecFromIter<T, I> for Vec<T>
|
||||||
where
|
where
|
||||||
I: Iterator<Item = T>,
|
I: Iterator<Item = T>,
|
||||||
{
|
{
|
||||||
default fn from_iter(iterator: I) -> Self {
|
default fn from_iter(iterator: I) -> Self {
|
||||||
SpecFromIterNested::from_iter(iterator)
|
SpecFromIterNested::from_iter(iterator)
|
||||||
@ -68,9 +68,9 @@ impl<T> SpecFromIter<T, IntoIter<T>> for Vec<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T: 'a, I> SpecFromIter<&'a T, I> for Vec<T>
|
impl<'a, T: 'a, I> SpecFromIter<&'a T, I> for Vec<T>
|
||||||
where
|
where
|
||||||
I: Iterator<Item = &'a T>,
|
I: Iterator<Item = &'a T>,
|
||||||
T: Clone,
|
T: Clone,
|
||||||
{
|
{
|
||||||
default fn from_iter(iterator: I) -> Self {
|
default fn from_iter(iterator: I) -> Self {
|
||||||
SpecFromIter::from_iter(iterator.cloned())
|
SpecFromIter::from_iter(iterator.cloned())
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
use core::iter::TrustedLen;
|
||||||
use core::ptr::{self};
|
use core::ptr::{self};
|
||||||
use core::iter::{TrustedLen};
|
|
||||||
|
|
||||||
use super::{Vec, SpecExtend};
|
use super::{SpecExtend, Vec};
|
||||||
|
|
||||||
/// Another specialization trait for Vec::from_iter
|
/// Another specialization trait for Vec::from_iter
|
||||||
/// necessary to manually prioritize overlapping specializations
|
/// necessary to manually prioritize overlapping specializations
|
||||||
@ -11,8 +11,8 @@ pub(super) trait SpecFromIterNested<T, I> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<T, I> SpecFromIterNested<T, I> for Vec<T>
|
impl<T, I> SpecFromIterNested<T, I> for Vec<T>
|
||||||
where
|
where
|
||||||
I: Iterator<Item = T>,
|
I: Iterator<Item = T>,
|
||||||
{
|
{
|
||||||
default fn from_iter(mut iterator: I) -> Self {
|
default fn from_iter(mut iterator: I) -> Self {
|
||||||
// Unroll the first iteration, as the vector is going to be
|
// Unroll the first iteration, as the vector is going to be
|
||||||
@ -40,8 +40,8 @@ impl<T, I> SpecFromIterNested<T, I> for Vec<T>
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<T, I> SpecFromIterNested<T, I> for Vec<T>
|
impl<T, I> SpecFromIterNested<T, I> for Vec<T>
|
||||||
where
|
where
|
||||||
I: TrustedLen<Item = T>,
|
I: TrustedLen<Item = T>,
|
||||||
{
|
{
|
||||||
fn from_iter(iterator: I) -> Self {
|
fn from_iter(iterator: I) -> Self {
|
||||||
let mut vector = match iterator.size_hint() {
|
let mut vector = match iterator.size_hint() {
|
||||||
|
@ -2,7 +2,7 @@ use crate::alloc::{Allocator, Global};
|
|||||||
use core::ptr::{self};
|
use core::ptr::{self};
|
||||||
use core::slice::{self};
|
use core::slice::{self};
|
||||||
|
|
||||||
use super::{Vec, Drain};
|
use super::{Drain, Vec};
|
||||||
|
|
||||||
/// A splicing iterator for `Vec`.
|
/// A splicing iterator for `Vec`.
|
||||||
///
|
///
|
||||||
|
Loading…
Reference in New Issue
Block a user