style: applying Rust style

This commit is contained in:
C 2020-12-05 01:44:07 +00:00
parent 6002b280f1
commit 2de8356f60
14 changed files with 75 additions and 81 deletions

View File

@ -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]> {

View File

@ -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>`.
/// ///

View File

@ -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.
/// ///

View File

@ -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.
/// ///

View File

@ -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;

View File

@ -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]) => {

View File

@ -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.

View File

@ -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> {

View File

@ -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 {

View File

@ -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
/// ///

View File

@ -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

View File

@ -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`.
/// ///