@@ -54,13 +54,17 @@ fn cold() {}
54
54
#[ cfg( not( feature = "nightly" ) ) ]
55
55
#[ inline]
56
56
fn likely ( b : bool ) -> bool {
57
- if !b { cold ( ) }
57
+ if !b {
58
+ cold ( )
59
+ }
58
60
b
59
61
}
60
62
#[ cfg( not( feature = "nightly" ) ) ]
61
63
#[ inline]
62
64
fn unlikely ( b : bool ) -> bool {
63
- if b { cold ( ) }
65
+ if b {
66
+ cold ( )
67
+ }
64
68
b
65
69
}
66
70
@@ -431,18 +435,18 @@ impl<T, A: AllocRef + Clone> RawTable<T, A> {
431
435
unsafe fn new_uninitialized (
432
436
alloc : A ,
433
437
buckets : usize ,
434
- fallability : Fallibility ,
438
+ fallibility : Fallibility ,
435
439
) -> Result < Self , TryReserveError > {
436
440
debug_assert ! ( buckets. is_power_of_two( ) ) ;
437
441
438
442
// Avoid `Option::ok_or_else` because it bloats LLVM IR.
439
443
let ( layout, ctrl_offset) = match calculate_layout :: < T > ( buckets) {
440
444
Some ( lco) => lco,
441
- None => return Err ( fallability . capacity_overflow ( ) ) ,
445
+ None => return Err ( fallibility . capacity_overflow ( ) ) ,
442
446
} ;
443
447
let ptr: NonNull < u8 > = match do_alloc ( & alloc, layout) {
444
448
Ok ( block) => block. cast ( ) ,
445
- Err ( _) => return Err ( fallability . alloc_err ( layout) ) ,
449
+ Err ( _) => return Err ( fallibility . alloc_err ( layout) ) ,
446
450
} ;
447
451
let ctrl = NonNull :: new_unchecked ( ptr. as_ptr ( ) . add ( ctrl_offset) ) ;
448
452
Ok ( Self {
@@ -460,7 +464,7 @@ impl<T, A: AllocRef + Clone> RawTable<T, A> {
460
464
fn fallible_with_capacity (
461
465
alloc : A ,
462
466
capacity : usize ,
463
- fallability : Fallibility ,
467
+ fallibility : Fallibility ,
464
468
) -> Result < Self , TryReserveError > {
465
469
if capacity == 0 {
466
470
Ok ( Self :: new_in ( alloc) )
@@ -469,9 +473,9 @@ impl<T, A: AllocRef + Clone> RawTable<T, A> {
469
473
// Avoid `Option::ok_or_else` because it bloats LLVM IR.
470
474
let buckets = match capacity_to_buckets ( capacity) {
471
475
Some ( buckets) => buckets,
472
- None => return Err ( fallability . capacity_overflow ( ) ) ,
476
+ None => return Err ( fallibility . capacity_overflow ( ) ) ,
473
477
} ;
474
- let result = Self :: new_uninitialized ( alloc, buckets, fallability ) ?;
478
+ let result = Self :: new_uninitialized ( alloc, buckets, fallibility ) ?;
475
479
result. ctrl ( 0 ) . write_bytes ( EMPTY , result. num_ctrl_bytes ( ) ) ;
476
480
477
481
Ok ( result)
@@ -794,12 +798,12 @@ impl<T, A: AllocRef + Clone> RawTable<T, A> {
794
798
& mut self ,
795
799
additional : usize ,
796
800
hasher : impl Fn ( & T ) -> u64 ,
797
- fallability : Fallibility ,
801
+ fallibility : Fallibility ,
798
802
) -> Result < ( ) , TryReserveError > {
799
803
// Avoid `Option::ok_or_else` because it bloats LLVM IR.
800
804
let new_items = match self . items . checked_add ( additional) {
801
805
Some ( new_items) => new_items,
802
- None => return Err ( fallability . capacity_overflow ( ) ) ,
806
+ None => return Err ( fallibility . capacity_overflow ( ) ) ,
803
807
} ;
804
808
let full_capacity = bucket_mask_to_capacity ( self . bucket_mask ) ;
805
809
if new_items <= full_capacity / 2 {
@@ -813,7 +817,7 @@ impl<T, A: AllocRef + Clone> RawTable<T, A> {
813
817
self . resize (
814
818
usize:: max ( new_items, full_capacity + 1 ) ,
815
819
hasher,
816
- fallability ,
820
+ fallibility ,
817
821
)
818
822
}
819
823
}
@@ -923,14 +927,14 @@ impl<T, A: AllocRef + Clone> RawTable<T, A> {
923
927
& mut self ,
924
928
capacity : usize ,
925
929
hasher : impl Fn ( & T ) -> u64 ,
926
- fallability : Fallibility ,
930
+ fallibility : Fallibility ,
927
931
) -> Result < ( ) , TryReserveError > {
928
932
unsafe {
929
933
debug_assert ! ( self . items <= capacity) ;
930
934
931
935
// Allocate and initialize the new table.
932
936
let mut new_table =
933
- Self :: fallible_with_capacity ( self . alloc . clone ( ) , capacity, fallability ) ?;
937
+ Self :: fallible_with_capacity ( self . alloc . clone ( ) , capacity, fallibility ) ?;
934
938
new_table. growth_left -= self . items ;
935
939
new_table. items = self . items ;
936
940
0 commit comments