@@ -2066,6 +2066,7 @@ impl<T: Clone, A: ReallocRef> SpecFromElem<A> for T {
2066
2066
}
2067
2067
}
2068
2068
2069
+ #[ allow( clippy:: use_self) ]
2069
2070
impl < A : ReallocRef > SpecFromElem < A > for u8 {
2070
2071
#[ inline]
2071
2072
fn try_from_elem_in ( elem : Self , n : usize , a : A ) -> Result < Vec < Self , A > , CollectionAllocErr < A > > {
@@ -2128,11 +2129,11 @@ impl_is_zero!(u64, |x| x == 0);
2128
2129
impl_is_zero ! ( u128 , |x| x == 0 ) ;
2129
2130
impl_is_zero ! ( usize , |x| x == 0 ) ;
2130
2131
2131
- impl_is_zero ! ( bool , |x| x == false ) ;
2132
+ impl_is_zero ! ( bool , |x: Self | !x ) ;
2132
2133
impl_is_zero ! ( char , |x| x == '\0' ) ;
2133
2134
2134
- impl_is_zero ! ( f32 , |x: f32 | x. to_bits( ) == 0 ) ;
2135
- impl_is_zero ! ( f64 , |x: f64 | x. to_bits( ) == 0 ) ;
2135
+ impl_is_zero ! ( f32 , |x: Self | x. to_bits( ) == 0 ) ;
2136
+ impl_is_zero ! ( f64 , |x: Self | x. to_bits( ) == 0 ) ;
2136
2137
2137
2138
unsafe impl < T > IsZero for * const T {
2138
2139
#[ inline]
@@ -2356,10 +2357,10 @@ where
2356
2357
// vector being full in the few subsequent loop iterations.
2357
2358
// So we get better branch prediction.
2358
2359
let mut vector = match iter. next ( ) {
2359
- None => return Ok ( Vec :: new_in ( a) ) ,
2360
+ None => return Ok ( Self :: new_in ( a) ) ,
2360
2361
Some ( element) => {
2361
2362
let ( lower, _) = iter. size_hint ( ) ;
2362
- let mut vector = Vec :: try_with_capacity_in ( lower. saturating_add ( 1 ) , a) ?;
2363
+ let mut vector = Self :: try_with_capacity_in ( lower. saturating_add ( 1 ) , a) ?;
2363
2364
unsafe {
2364
2365
ptr:: write ( vector. get_unchecked_mut ( 0 ) , element) ;
2365
2366
vector. set_len ( 1 ) ;
@@ -2381,7 +2382,7 @@ where
2381
2382
I : TrustedLen < Item = T > ,
2382
2383
{
2383
2384
default fn try_from_iter_in ( iter : I , a : A ) -> Result < Self , CollectionAllocErr < A > > {
2384
- let mut vector = Vec :: new_in ( a) ;
2385
+ let mut vector = Self :: new_in ( a) ;
2385
2386
vector. try_spec_extend ( iter) ?;
2386
2387
Ok ( vector)
2387
2388
}
@@ -2424,7 +2425,7 @@ impl<T, A: ReallocRef> SpecExtend<T, IntoIter<T, A>, A> for Vec<T, A> {
2424
2425
let ptr: * const T = iter. buf . ptr ( ) ;
2425
2426
if ptr == iter. ptr {
2426
2427
unsafe {
2427
- let vec = Vec :: from_raw_parts_in (
2428
+ let vec = Self :: from_raw_parts_in (
2428
2429
iter. buf . ptr ( ) ,
2429
2430
iter. len ( ) ,
2430
2431
iter. buf . capacity ( ) ,
@@ -2434,7 +2435,7 @@ impl<T, A: ReallocRef> SpecExtend<T, IntoIter<T, A>, A> for Vec<T, A> {
2434
2435
Ok ( vec)
2435
2436
}
2436
2437
} else {
2437
- let mut vector = Vec :: new_in ( a) ;
2438
+ let mut vector = Self :: new_in ( a) ;
2438
2439
vector. try_spec_extend ( iter) ?;
2439
2440
Ok ( vector)
2440
2441
}
0 commit comments