@@ -457,10 +457,7 @@ impl<T> Vec<T> {
457457 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
458458 #[ must_use]
459459 pub const fn new ( ) -> Self {
460- Vec {
461- buf : RawVec :: new ( ) ,
462- len : 0 ,
463- }
460+ Vec { buf : RawVec :: new ( ) , len : 0 }
464461 }
465462
466463 /// Constructs a new, empty `Vec<T>` with at least the specified capacity.
@@ -867,10 +864,7 @@ impl<T, A: Allocator> Vec<T, A> {
867864 #[ inline]
868865 #[ unstable( feature = "allocator_api" , issue = "32838" ) ]
869866 pub const fn new_in ( alloc : A ) -> Self {
870- Vec {
871- buf : RawVec :: new_in ( alloc) ,
872- len : 0 ,
873- }
867+ Vec { buf : RawVec :: new_in ( alloc) , len : 0 }
874868 }
875869
876870 /// Constructs a new, empty `Vec<T, A>` with at least the specified capacity
@@ -932,10 +926,7 @@ impl<T, A: Allocator> Vec<T, A> {
932926 #[ inline]
933927 #[ unstable( feature = "allocator_api" , issue = "32838" ) ]
934928 pub fn with_capacity_in ( capacity : usize , alloc : A ) -> Self {
935- Vec {
936- buf : RawVec :: with_capacity_in ( capacity, alloc) ,
937- len : 0 ,
938- }
929+ Vec { buf : RawVec :: with_capacity_in ( capacity, alloc) , len : 0 }
939930 }
940931
941932 /// Constructs a new, empty `Vec<T, A>` with at least the specified capacity
@@ -953,10 +944,7 @@ impl<T, A: Allocator> Vec<T, A> {
953944 #[ unstable( feature = "allocator_api" , issue = "32838" ) ]
954945 // #[unstable(feature = "try_with_capacity", issue = "91913")]
955946 pub fn try_with_capacity_in ( capacity : usize , alloc : A ) -> Result < Self , TryReserveError > {
956- Ok ( Vec {
957- buf : RawVec :: try_with_capacity_in ( capacity, alloc) ?,
958- len : 0 ,
959- } )
947+ Ok ( Vec { buf : RawVec :: try_with_capacity_in ( capacity, alloc) ?, len : 0 } )
960948 }
961949
962950 /// Creates a `Vec<T, A>` directly from a pointer, a length, a capacity,
@@ -1075,12 +1063,7 @@ impl<T, A: Allocator> Vec<T, A> {
10751063 "Vec::from_raw_parts_in requires that length <= capacity" ,
10761064 ( length: usize = length, capacity: usize = capacity) => length <= capacity
10771065 ) ;
1078- unsafe {
1079- Vec {
1080- buf : RawVec :: from_raw_parts_in ( ptr, capacity, alloc) ,
1081- len : length,
1082- }
1083- }
1066+ unsafe { Vec { buf : RawVec :: from_raw_parts_in ( ptr, capacity, alloc) , len : length } }
10841067 }
10851068
10861069 #[ doc( alias = "from_non_null_parts_in" ) ]
@@ -1201,12 +1184,7 @@ impl<T, A: Allocator> Vec<T, A> {
12011184 "Vec::from_parts_in requires that length <= capacity" ,
12021185 ( length: usize = length, capacity: usize = capacity) => length <= capacity
12031186 ) ;
1204- unsafe {
1205- Vec {
1206- buf : RawVec :: from_nonnull_in ( ptr, capacity, alloc) ,
1207- len : length,
1208- }
1209- }
1187+ unsafe { Vec { buf : RawVec :: from_nonnull_in ( ptr, capacity, alloc) , len : length } }
12101188 }
12111189
12121190 /// Decomposes a `Vec<T>` into its raw components: `(pointer, length, capacity, allocator)`.
@@ -2328,9 +2306,7 @@ impl<T, A: Allocator> Vec<T, A> {
23282306 unsafe {
23292307 ptr:: copy (
23302308 self . v . as_ptr ( ) . add ( self . processed_len ) ,
2331- self . v
2332- . as_mut_ptr ( )
2333- . add ( self . processed_len - self . deleted_cnt ) ,
2309+ self . v . as_mut_ptr ( ) . add ( self . processed_len - self . deleted_cnt ) ,
23342310 self . original_len - self . processed_len ,
23352311 ) ;
23362312 }
@@ -2342,12 +2318,7 @@ impl<T, A: Allocator> Vec<T, A> {
23422318 }
23432319 }
23442320
2345- let mut g = BackshiftOnDrop {
2346- v : self ,
2347- processed_len : 0 ,
2348- deleted_cnt : 0 ,
2349- original_len,
2350- } ;
2321+ let mut g = BackshiftOnDrop { v : self , processed_len : 0 , deleted_cnt : 0 , original_len } ;
23512322
23522323 fn process_loop < F , T , A : Allocator , const DELETED : bool > (
23532324 original_len : usize ,
@@ -2521,11 +2492,8 @@ impl<T, A: Allocator> Vec<T, A> {
25212492 * doing slice partition_dedup + truncate */
25222493
25232494 // Construct gap first and then drop item to avoid memory corruption if `T::drop` panics.
2524- let mut gap = FillGapOnDrop {
2525- read : first_duplicate_idx + 1 ,
2526- write : first_duplicate_idx,
2527- vec : self ,
2528- } ;
2495+ let mut gap =
2496+ FillGapOnDrop { read : first_duplicate_idx + 1 , write : first_duplicate_idx, vec : self } ;
25292497 unsafe {
25302498 // SAFETY: we checked that first_duplicate_idx in bounds before.
25312499 // If drop panics, `gap` would remove this item without drop.
@@ -3756,14 +3724,7 @@ impl<T, A: Allocator> IntoIterator for Vec<T, A> {
37563724 begin. add ( me. len ( ) ) as * const T
37573725 } ;
37583726 let cap = me. buf . capacity ( ) ;
3759- IntoIter {
3760- buf,
3761- phantom : PhantomData ,
3762- cap,
3763- alloc,
3764- ptr : buf,
3765- end,
3766- }
3727+ IntoIter { buf, phantom : PhantomData , cap, alloc, ptr : buf, end }
37673728 }
37683729 }
37693730}
@@ -3930,10 +3891,7 @@ impl<T, A: Allocator> Vec<T, A> {
39303891 R : RangeBounds < usize > ,
39313892 I : IntoIterator < Item = T > ,
39323893 {
3933- Splice {
3934- drain : self . drain ( range) ,
3935- replace_with : replace_with. into_iter ( ) ,
3936- }
3894+ Splice { drain : self . drain ( range) , replace_with : replace_with. into_iter ( ) }
39373895 }
39383896
39393897 /// Creates an iterator which uses a closure to determine if an element in the range should be removed.
0 commit comments