about summary refs log tree commit diff
diff options
context:
space:
mode:
authorC <DeveloperC@protonmail.com>2020-12-05 01:44:07 +0000
committerC <DeveloperC@protonmail.com>2020-12-29 14:03:30 +0000
commit2de8356f60a7a9800809ab60e813fcfd4a7accf2 (patch)
tree7e195f465b4af0f77dfe22d811cc34a6ea932d2e
parent6002b280f119a12631da0d1bb7e6adad53cefc95 (diff)
downloadrust-2de8356f60a7a9800809ab60e813fcfd4a7accf2.tar.gz
rust-2de8356f60a7a9800809ab60e813fcfd4a7accf2.zip
style: applying Rust style
-rw-r--r--library/alloc/src/vec/cow.rs10
-rw-r--r--library/alloc/src/vec/drain.rs8
-rw-r--r--library/alloc/src/vec/drain_filter.rs26
-rw-r--r--library/alloc/src/vec/in_place_drop.rs6
-rw-r--r--library/alloc/src/vec/into_iter.rs16
-rw-r--r--library/alloc/src/vec/is_zero.rs2
-rw-r--r--library/alloc/src/vec/mod.rs4
-rw-r--r--library/alloc/src/vec/partial_eq.rs4
-rw-r--r--library/alloc/src/vec/source_iter_marker.rs16
-rw-r--r--library/alloc/src/vec/spec_extend.rs26
-rw-r--r--library/alloc/src/vec/spec_from_elem.rs6
-rw-r--r--library/alloc/src/vec/spec_from_iter.rs14
-rw-r--r--library/alloc/src/vec/spec_from_iter_nested.rs12
-rw-r--r--library/alloc/src/vec/splice.rs4
14 files changed, 74 insertions, 80 deletions
diff --git a/library/alloc/src/vec/cow.rs b/library/alloc/src/vec/cow.rs
index 15942f9892d..73d15d30647 100644
--- a/library/alloc/src/vec/cow.rs
+++ b/library/alloc/src/vec/cow.rs
@@ -1,7 +1,7 @@
 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")]
 impl<'a, T: Clone> From<&'a [T]> for Cow<'a, [T]> {
@@ -26,10 +26,10 @@ impl<'a, T: Clone> From<&'a Vec<T>> for Cow<'a, [T]> {
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a, T> FromIterator<T> for Cow<'a, [T]>
-    where
-        T: Clone,
+where
+    T: Clone,
 {
     fn from_iter<I: IntoIterator<Item = T>>(it: I) -> Cow<'a, [T]> {
         Cow::Owned(FromIterator::from_iter(it))
     }
-}
\ No newline at end of file
+}
diff --git a/library/alloc/src/vec/drain.rs b/library/alloc/src/vec/drain.rs
index e61f17a1c30..fb32d144f87 100644
--- a/library/alloc/src/vec/drain.rs
+++ b/library/alloc/src/vec/drain.rs
@@ -1,13 +1,11 @@
 use crate::alloc::{Allocator, Global};
-use core::iter::{
-    FusedIterator, TrustedLen,
-};
+use core::fmt;
+use core::iter::{FusedIterator, TrustedLen};
 use core::mem::{self};
 use core::ptr::{self, NonNull};
 use core::slice::{self};
-use core::fmt;
 
-use super::{Vec};
+use super::Vec;
 
 /// A draining iterator for `Vec<T>`.
 ///
diff --git a/library/alloc/src/vec/drain_filter.rs b/library/alloc/src/vec/drain_filter.rs
index 9d898c7c756..3c37c92ae44 100644
--- a/library/alloc/src/vec/drain_filter.rs
+++ b/library/alloc/src/vec/drain_filter.rs
@@ -1,8 +1,8 @@
+use crate::alloc::{Allocator, Global};
 use core::ptr::{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.
 ///
@@ -45,8 +45,8 @@ pub struct DrainFilter<
 }
 
 impl<T, F, A: Allocator> DrainFilter<'_, T, F, A>
-    where
-        F: FnMut(&mut T) -> bool,
+where
+    F: FnMut(&mut T) -> bool,
 {
     /// Returns a reference to the underlying allocator.
     #[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")]
 impl<T, F, A: Allocator> Iterator for DrainFilter<'_, T, F, A>
-    where
-        F: FnMut(&mut T) -> bool,
+where
+    F: FnMut(&mut T) -> bool,
 {
     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")]
 impl<T, F, A: Allocator> Drop for DrainFilter<'_, T, F, A>
-    where
-        F: FnMut(&mut T) -> bool,
+where
+    F: FnMut(&mut T) -> bool,
 {
     fn drop(&mut self) {
         struct BackshiftOnDrop<'a, 'b, T, F, A: Allocator>
-            where
-                F: FnMut(&mut T) -> bool,
+        where
+            F: FnMut(&mut T) -> bool,
         {
             drain: &'b mut DrainFilter<'a, T, F, A>,
         }
 
         impl<'a, 'b, T, F, A: Allocator> Drop for BackshiftOnDrop<'a, 'b, T, F, A>
-            where
-                F: FnMut(&mut T) -> bool,
+        where
+            F: FnMut(&mut T) -> bool,
         {
             fn drop(&mut self) {
                 unsafe {
@@ -140,4 +140,4 @@ impl<T, F, A: Allocator> Drop for DrainFilter<'_, T, F, A>
             backshift.drain.for_each(drop);
         }
     }
-}
\ No newline at end of file
+}
diff --git a/library/alloc/src/vec/in_place_drop.rs b/library/alloc/src/vec/in_place_drop.rs
index 3a0ecc529c0..354d25c2389 100644
--- a/library/alloc/src/vec/in_place_drop.rs
+++ b/library/alloc/src/vec/in_place_drop.rs
@@ -3,9 +3,9 @@ use core::slice::{self};
 
 // 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.
-pub (super) struct InPlaceDrop<T> {
-    pub (super) inner: *mut T,
-    pub (super) dst: *mut T,
+pub(super) struct InPlaceDrop<T> {
+    pub(super) inner: *mut T,
+    pub(super) dst: *mut T,
 }
 
 impl<T> InPlaceDrop<T> {
diff --git a/library/alloc/src/vec/into_iter.rs b/library/alloc/src/vec/into_iter.rs
index c4330df4ad9..1788690d96b 100644
--- a/library/alloc/src/vec/into_iter.rs
+++ b/library/alloc/src/vec/into_iter.rs
@@ -1,14 +1,12 @@
 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, TrustedRandomAccess};
 use core::marker::PhantomData;
-use core::intrinsics::{arith_offset};
 use core::mem::{self};
-use core::fmt;
 use core::ptr::{self, NonNull};
 use core::slice::{self};
-use core::iter::{
-    FusedIterator, InPlaceIterable, SourceIter, TrustedLen, TrustedRandomAccess,
-};
 
 /// 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
-        where
-            Self: TrustedRandomAccess,
+    where
+        Self: TrustedRandomAccess,
     {
         // 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)`
@@ -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
 // and thus we can't implement drop-handling
 unsafe impl<T, A: Allocator> TrustedRandomAccess for IntoIter<T, A>
-    where
-        T: Copy,
+where
+    T: Copy,
 {
     fn may_have_side_effect() -> bool {
         false
diff --git a/library/alloc/src/vec/is_zero.rs b/library/alloc/src/vec/is_zero.rs
index 961f6ca171b..b5739970b6e 100644
--- a/library/alloc/src/vec/is_zero.rs
+++ b/library/alloc/src/vec/is_zero.rs
@@ -68,4 +68,4 @@ unsafe impl<T: ?Sized> IsZero for Option<Box<T>> {
     fn is_zero(&self) -> bool {
         self.is_none()
     }
-}
\ No newline at end of file
+}
diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs
index 2947c6a299f..2a83eb33fe3 100644
--- a/library/alloc/src/vec/mod.rs
+++ b/library/alloc/src/vec/mod.rs
@@ -58,7 +58,7 @@ use core::convert::TryFrom;
 use core::fmt;
 use core::hash::{Hash, Hasher};
 use core::intrinsics::{arith_offset, assume};
-use core::iter::{FromIterator};
+use core::iter::FromIterator;
 use core::marker::PhantomData;
 use core::mem::{self, ManuallyDrop, MaybeUninit};
 use core::ops::{self, Index, IndexMut, Range, RangeBounds};
@@ -88,9 +88,9 @@ mod drain;
 
 mod cow;
 
+pub(crate) use self::into_iter::AsIntoIter;
 #[stable(feature = "rust1", since = "1.0.0")]
 pub use self::into_iter::IntoIter;
-pub (crate) use self::into_iter::AsIntoIter;
 
 mod into_iter;
 
diff --git a/library/alloc/src/vec/partial_eq.rs b/library/alloc/src/vec/partial_eq.rs
index 617f0404439..ff90b6caf46 100644
--- a/library/alloc/src/vec/partial_eq.rs
+++ b/library/alloc/src/vec/partial_eq.rs
@@ -1,7 +1,7 @@
-use crate::alloc::{Allocator};
+use crate::alloc::Allocator;
 use crate::borrow::Cow;
 
-use super::{Vec};
+use super::Vec;
 
 macro_rules! __impl_slice_eq1 {
     ([$($vars:tt)*] $lhs:ty, $rhs:ty $(where $ty:ty: $bound:ident)?, #[$stability:meta]) => {
diff --git a/library/alloc/src/vec/source_iter_marker.rs b/library/alloc/src/vec/source_iter_marker.rs
index eb3ae01a47e..8c0e95559fa 100644
--- a/library/alloc/src/vec/source_iter_marker.rs
+++ b/library/alloc/src/vec/source_iter_marker.rs
@@ -1,10 +1,8 @@
-use core::iter::{
-    InPlaceIterable, SourceIter,
-};
+use core::iter::{InPlaceIterable, SourceIter};
 use core::mem::{self, ManuallyDrop};
 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
 /// 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
 /// additional bounds on the impl.
 #[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
 // 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, I> SpecFromIter<T, I> for Vec<T>
-    where
-        I: Iterator<Item = T> + SourceIterMarker,
+where
+    I: Iterator<Item = T> + SourceIterMarker,
 {
     default fn from_iter(mut iterator: I) -> Self {
         // 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
         if mem::size_of::<T>() == 0
             || 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::<<<I as SourceIter>::Source as AsIntoIter>::Item>()
+                != mem::align_of::<<<I as SourceIter>::Source as AsIntoIter>::Item>()
         {
             // fallback to more generic implementations
             return SpecFromIterNested::from_iter(iterator);
diff --git a/library/alloc/src/vec/spec_extend.rs b/library/alloc/src/vec/spec_extend.rs
index 6959733d074..b6186a7ebaf 100644
--- a/library/alloc/src/vec/spec_extend.rs
+++ b/library/alloc/src/vec/spec_extend.rs
@@ -1,9 +1,9 @@
-use crate::alloc::{Allocator};
-use core::iter::{TrustedLen};
-use core::slice::{self};
+use crate::alloc::Allocator;
+use core::iter::TrustedLen;
 use core::ptr::{self};
+use core::slice::{self};
 
-use super::{Vec, IntoIter, SetLenOnDrop};
+use super::{IntoIter, SetLenOnDrop, Vec};
 
 // Specialization trait used for Vec::extend
 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>
-    where
-        I: Iterator<Item = T>,
+where
+    I: Iterator<Item = T>,
 {
     default fn spec_extend(&mut self, iter: I) {
         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>
-    where
-        I: TrustedLen<Item = T>,
+where
+    I: TrustedLen<Item = T>,
 {
     default fn spec_extend(&mut self, iterator: I) {
         // 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>
-    where
-        I: Iterator<Item = &'a T>,
-        T: Clone,
+where
+    I: Iterator<Item = &'a T>,
+    T: Clone,
 {
     default fn spec_extend(&mut self, iterator: I) {
         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>
-    where
-        T: Copy,
+where
+    T: Copy,
 {
     fn spec_extend(&mut self, iterator: slice::Iter<'a, T>) {
         let slice = iterator.as_slice();
diff --git a/library/alloc/src/vec/spec_from_elem.rs b/library/alloc/src/vec/spec_from_elem.rs
index ef89054ea13..de610174783 100644
--- a/library/alloc/src/vec/spec_from_elem.rs
+++ b/library/alloc/src/vec/spec_from_elem.rs
@@ -1,8 +1,8 @@
-use crate::alloc::{Allocator};
+use crate::alloc::Allocator;
 use crate::raw_vec::RawVec;
 use core::ptr::{self};
 
-use super::{Vec, IsZero, ExtendElement};
+use super::{ExtendElement, IsZero, Vec};
 
 // Specialization trait used for Vec::from_elem
 pub(super) trait SpecFromElem: Sized {
@@ -57,4 +57,4 @@ impl<T: Clone + IsZero> SpecFromElem for T {
         v.extend_with(n, ExtendElement(elem));
         v
     }
-}
\ No newline at end of file
+}
diff --git a/library/alloc/src/vec/spec_from_iter.rs b/library/alloc/src/vec/spec_from_iter.rs
index bf07fc97f89..4349d158210 100644
--- a/library/alloc/src/vec/spec_from_iter.rs
+++ b/library/alloc/src/vec/spec_from_iter.rs
@@ -1,9 +1,9 @@
 use crate::alloc::Global;
-use core::mem::{ManuallyDrop};
+use core::mem::ManuallyDrop;
 use core::ptr::{self};
 use core::slice::{self};
 
-use super::{Vec, IntoIter, SpecFromIterNested, SpecExtend};
+use super::{IntoIter, SpecExtend, SpecFromIterNested, Vec};
 
 /// 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>
-    where
-        I: Iterator<Item = T>,
+where
+    I: Iterator<Item = T>,
 {
     default fn from_iter(iterator: I) -> Self {
         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>
-    where
-        I: Iterator<Item = &'a T>,
-        T: Clone,
+where
+    I: Iterator<Item = &'a T>,
+    T: Clone,
 {
     default fn from_iter(iterator: I) -> Self {
         SpecFromIter::from_iter(iterator.cloned())
diff --git a/library/alloc/src/vec/spec_from_iter_nested.rs b/library/alloc/src/vec/spec_from_iter_nested.rs
index 0da42844c96..6abd4ff2a3f 100644
--- a/library/alloc/src/vec/spec_from_iter_nested.rs
+++ b/library/alloc/src/vec/spec_from_iter_nested.rs
@@ -1,7 +1,7 @@
+use core::iter::TrustedLen;
 use core::ptr::{self};
-use core::iter::{TrustedLen};
 
-use super::{Vec, SpecExtend};
+use super::{SpecExtend, Vec};
 
 /// Another specialization trait for Vec::from_iter
 /// 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>
-    where
-        I: Iterator<Item = T>,
+where
+    I: Iterator<Item = T>,
 {
     default fn from_iter(mut iterator: I) -> Self {
         // 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>
-    where
-        I: TrustedLen<Item = T>,
+where
+    I: TrustedLen<Item = T>,
 {
     fn from_iter(iterator: I) -> Self {
         let mut vector = match iterator.size_hint() {
diff --git a/library/alloc/src/vec/splice.rs b/library/alloc/src/vec/splice.rs
index 86b2fa0968e..0a27b5b62ec 100644
--- a/library/alloc/src/vec/splice.rs
+++ b/library/alloc/src/vec/splice.rs
@@ -2,7 +2,7 @@ use crate::alloc::{Allocator, Global};
 use core::ptr::{self};
 use core::slice::{self};
 
-use super::{Vec, Drain};
+use super::{Drain, Vec};
 
 /// A splicing iterator for `Vec`.
 ///
@@ -130,4 +130,4 @@ impl<T, A: Allocator> Drain<'_, T, A> {
         }
         self.tail_start = new_tail_start;
     }
-}
\ No newline at end of file
+}