File tree Expand file tree Collapse file tree 3 files changed +6
-9
lines changed
external_trait_impls/rayon Expand file tree Collapse file tree 3 files changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -346,7 +346,7 @@ where
346346 self . len ( ) == other. len ( )
347347 && self
348348 . into_par_iter ( )
349- . all ( |( key, value) | other. get ( key) . map_or ( false , |v| * value == * v) )
349+ . all ( |( key, value) | other. get ( key) . is_some_and ( |v| * value == * v) )
350350 }
351351}
352352
@@ -455,7 +455,7 @@ where
455455 // Reserve the entire length if the map is empty.
456456 // Otherwise reserve half the length (rounded up), so the map
457457 // will only resize twice in the worst case.
458- let reserve = if map. is_empty ( ) { len } else { ( len + 1 ) / 2 } ;
458+ let reserve = if map. is_empty ( ) { len } else { len. div_ceil ( 2 ) } ;
459459 map. reserve ( reserve) ;
460460 for vec in list {
461461 map. extend ( vec) ;
Original file line number Diff line number Diff line change @@ -384,7 +384,7 @@ where
384384 // Reserve the entire length if the set is empty.
385385 // Otherwise reserve half the length (rounded up), so the set
386386 // will only resize twice in the worst case.
387- let reserve = if set. is_empty ( ) { len } else { ( len + 1 ) / 2 } ;
387+ let reserve = if set. is_empty ( ) { len } else { len. div_ceil ( 2 ) } ;
388388 set. reserve ( reserve) ;
389389 for vec in list {
390390 set. extend ( vec) ;
Original file line number Diff line number Diff line change @@ -242,10 +242,7 @@ where
242242 Q : Hash + ?Sized ,
243243 S : BuildHasher ,
244244{
245- use core:: hash:: Hasher ;
246- let mut state = hash_builder. build_hasher ( ) ;
247- val. hash ( & mut state) ;
248- state. finish ( )
245+ hash_builder. hash_one ( val)
249246}
250247
251248#[ cfg( feature = "nightly" ) ]
@@ -2022,7 +2019,7 @@ where
20222019 }
20232020
20242021 self . iter ( )
2025- . all ( |( key, value) | other. get ( key) . map_or ( false , |v| * value == * v) )
2022+ . all ( |( key, value) | other. get ( key) . is_some_and ( |v| * value == * v) )
20262023 }
20272024}
20282025
@@ -4493,7 +4490,7 @@ where
44934490 let reserve = if self . is_empty ( ) {
44944491 iter. size_hint ( ) . 0
44954492 } else {
4496- ( iter. size_hint ( ) . 0 + 1 ) / 2
4493+ iter. size_hint ( ) . 0 . div_ceil ( 2 )
44974494 } ;
44984495 self . reserve ( reserve) ;
44994496 iter. for_each ( move |( k, v) | {
You can’t perform that action at this time.
0 commit comments