@@ -992,7 +992,7 @@ impl<T, A: Allocator + Clone> RawTable<T, A> {
992
992
& mut self ,
993
993
cx : & mut C ,
994
994
hash : u64 ,
995
- eq : impl Fn ( & mut C , & T ) -> bool ,
995
+ eq : fn ( & mut C , & T ) -> bool ,
996
996
) -> bool {
997
997
// Avoid `Option::map` because it bloats LLVM IR.
998
998
if let Some ( bucket) = self . find_with_context ( cx, hash, eq) {
@@ -1035,7 +1035,7 @@ impl<T, A: Allocator + Clone> RawTable<T, A> {
1035
1035
& mut self ,
1036
1036
cx : & mut C ,
1037
1037
hash : u64 ,
1038
- eq : impl Fn ( & mut C , & T ) -> bool ,
1038
+ eq : fn ( & mut C , & T ) -> bool ,
1039
1039
) -> Option < T > {
1040
1040
// Avoid `Option::map` because it bloats LLVM IR.
1041
1041
match self . find_with_context ( cx, hash, eq) {
@@ -1074,8 +1074,8 @@ impl<T, A: Allocator + Clone> RawTable<T, A> {
1074
1074
1075
1075
/// Shrinks the table to fit `max(self.len(), min_size)` elements.
1076
1076
#[ cfg_attr( feature = "inline-more" , inline) ]
1077
- pub fn shrink_to ( & mut self , min_size : usize , hasher : impl Fn ( & T ) -> u64 ) {
1078
- self . shrink_to_with_context ( & mut ( ) , min_size, |_ , value| hasher ( value) ) ;
1077
+ pub fn shrink_to ( & mut self , min_size : usize , mut hasher : impl Fn ( & T ) -> u64 ) {
1078
+ self . shrink_to_with_context ( & mut hasher , min_size, |hasher , value| hasher ( value) ) ;
1079
1079
}
1080
1080
1081
1081
/// Shrinks the table to fit `max(self.len(), min_size)` elements.
@@ -1087,7 +1087,7 @@ impl<T, A: Allocator + Clone> RawTable<T, A> {
1087
1087
& mut self ,
1088
1088
cx : & mut C ,
1089
1089
min_size : usize ,
1090
- hasher : impl Fn ( & mut C , & T ) -> u64 ,
1090
+ hasher : fn ( & mut C , & T ) -> u64 ,
1091
1091
) {
1092
1092
// Calculate the minimal number of elements that we need to reserve
1093
1093
// space for.
@@ -1131,8 +1131,8 @@ impl<T, A: Allocator + Clone> RawTable<T, A> {
1131
1131
/// Ensures that at least `additional` items can be inserted into the table
1132
1132
/// without reallocation.
1133
1133
#[ cfg_attr( feature = "inline-more" , inline) ]
1134
- pub fn reserve ( & mut self , additional : usize , hasher : impl Fn ( & T ) -> u64 ) {
1135
- self . reserve_with_context ( & mut ( ) , additional, |_ , value| hasher ( value) )
1134
+ pub fn reserve ( & mut self , additional : usize , mut hasher : impl Fn ( & T ) -> u64 ) {
1135
+ self . reserve_with_context ( & mut hasher , additional, |hasher , value| hasher ( value) )
1136
1136
}
1137
1137
1138
1138
/// Ensures that at least `additional` items can be inserted into the table
@@ -1145,7 +1145,7 @@ impl<T, A: Allocator + Clone> RawTable<T, A> {
1145
1145
& mut self ,
1146
1146
cx : & mut C ,
1147
1147
additional : usize ,
1148
- hasher : impl Fn ( & mut C , & T ) -> u64 ,
1148
+ hasher : fn ( & mut C , & T ) -> u64 ,
1149
1149
) {
1150
1150
if unlikely ( additional > self . table . growth_left ) {
1151
1151
// Avoid `Result::unwrap_or_else` because it bloats LLVM IR.
@@ -1164,9 +1164,9 @@ impl<T, A: Allocator + Clone> RawTable<T, A> {
1164
1164
pub fn try_reserve (
1165
1165
& mut self ,
1166
1166
additional : usize ,
1167
- hasher : impl Fn ( & T ) -> u64 ,
1167
+ mut hasher : impl Fn ( & T ) -> u64 ,
1168
1168
) -> Result < ( ) , TryReserveError > {
1169
- self . try_reserve_with_context ( & mut ( ) , additional, |_ , value| hasher ( value) )
1169
+ self . try_reserve_with_context ( & mut hasher , additional, |hasher , value| hasher ( value) )
1170
1170
}
1171
1171
1172
1172
/// Tries to ensure that at least `additional` items can be inserted into
@@ -1179,7 +1179,7 @@ impl<T, A: Allocator + Clone> RawTable<T, A> {
1179
1179
& mut self ,
1180
1180
cx : & mut C ,
1181
1181
additional : usize ,
1182
- hasher : impl Fn ( & mut C , & T ) -> u64 ,
1182
+ hasher : fn ( & mut C , & T ) -> u64 ,
1183
1183
) -> Result < ( ) , TryReserveError > {
1184
1184
if additional > self . table . growth_left {
1185
1185
self . reserve_rehash ( cx, additional, hasher, Fallibility :: Fallible )
@@ -1195,7 +1195,7 @@ impl<T, A: Allocator + Clone> RawTable<T, A> {
1195
1195
& mut self ,
1196
1196
cx : & mut C ,
1197
1197
additional : usize ,
1198
- hasher : impl Fn ( & mut C , & T ) -> u64 ,
1198
+ hasher : fn ( & mut C , & T ) -> u64 ,
1199
1199
fallibility : Fallibility ,
1200
1200
) -> Result < ( ) , TryReserveError > {
1201
1201
unsafe {
@@ -1233,7 +1233,7 @@ impl<T, A: Allocator + Clone> RawTable<T, A> {
1233
1233
& mut self ,
1234
1234
cx : & mut C ,
1235
1235
capacity : usize ,
1236
- hasher : impl Fn ( & mut C , & T ) -> u64 ,
1236
+ hasher : fn ( & mut C , & T ) -> u64 ,
1237
1237
fallibility : Fallibility ,
1238
1238
) -> Result < ( ) , TryReserveError > {
1239
1239
// SAFETY:
@@ -1356,17 +1356,17 @@ impl<T, A: Allocator + Clone> RawTable<T, A> {
1356
1356
pub fn find_or_find_insert_slot (
1357
1357
& mut self ,
1358
1358
hash : u64 ,
1359
- mut eq : impl FnMut ( & T ) -> bool ,
1359
+ eq : impl FnMut ( & T ) -> bool ,
1360
1360
hasher : impl Fn ( & T ) -> u64 ,
1361
1361
) -> Result < Bucket < T > , InsertSlot > {
1362
1362
// NB: Since `eq` is the only one which actually uses a mutable
1363
1363
// environment, it's the only one we need to explicitly pass around
1364
1364
// through the context.
1365
1365
self . find_or_find_insert_slot_with_context (
1366
- & mut eq ,
1366
+ & mut ( eq , hasher ) ,
1367
1367
hash,
1368
- |eq , value| eq ( value) ,
1369
- |_ , value| hasher ( value) ,
1368
+ |( eq , _ ) , value| eq ( value) ,
1369
+ |( _ , hasher ) , value| hasher ( value) ,
1370
1370
)
1371
1371
}
1372
1372
@@ -1385,8 +1385,8 @@ impl<T, A: Allocator + Clone> RawTable<T, A> {
1385
1385
& mut self ,
1386
1386
cx : & mut C ,
1387
1387
hash : u64 ,
1388
- eq : impl Fn ( & mut C , & T ) -> bool ,
1389
- hasher : impl Fn ( & mut C , & T ) -> u64 ,
1388
+ eq : fn ( & mut C , & T ) -> bool ,
1389
+ hasher : fn ( & mut C , & T ) -> u64 ,
1390
1390
) -> Result < Bucket < T > , InsertSlot > {
1391
1391
self . reserve_with_context ( cx, 1 , hasher) ;
1392
1392
@@ -1433,7 +1433,7 @@ impl<T, A: Allocator + Clone> RawTable<T, A> {
1433
1433
& self ,
1434
1434
cx : & mut C ,
1435
1435
hash : u64 ,
1436
- eq : impl Fn ( & mut C , & T ) -> bool ,
1436
+ eq : fn ( & mut C , & T ) -> bool ,
1437
1437
) -> Option < Bucket < T > > {
1438
1438
let result = self . table . find_inner ( cx, hash, & |cx, index| unsafe {
1439
1439
eq ( cx, self . bucket ( index) . as_ref ( ) )
@@ -1461,7 +1461,7 @@ impl<T, A: Allocator + Clone> RawTable<T, A> {
1461
1461
& self ,
1462
1462
cx : & mut C ,
1463
1463
hash : u64 ,
1464
- eq : impl Fn ( & mut C , & T ) -> bool ,
1464
+ eq : fn ( & mut C , & T ) -> bool ,
1465
1465
) -> Option < & T > {
1466
1466
// Avoid `Option::map` because it bloats LLVM IR.
1467
1467
match self . find_with_context ( cx, hash, eq) {
@@ -1485,7 +1485,7 @@ impl<T, A: Allocator + Clone> RawTable<T, A> {
1485
1485
& mut self ,
1486
1486
cx : & mut C ,
1487
1487
hash : u64 ,
1488
- eq : impl Fn ( & mut C , & T ) -> bool ,
1488
+ eq : fn ( & mut C , & T ) -> bool ,
1489
1489
) -> Option < & mut T > {
1490
1490
// Avoid `Option::map` because it bloats LLVM IR.
1491
1491
match self . find_with_context ( cx, hash, eq) {
0 commit comments