@@ -260,29 +260,6 @@ where
260
260
hash_builder. hash_one ( val)
261
261
}
262
262
263
- #[ cfg( not( feature = "nightly" ) ) ]
264
- #[ cfg_attr( feature = "inline-more" , inline) ]
265
- pub ( crate ) fn make_insert_hash < K , S > ( hash_builder : & S , val : & K ) -> u64
266
- where
267
- K : Hash ,
268
- S : BuildHasher ,
269
- {
270
- use core:: hash:: Hasher ;
271
- let mut state = hash_builder. build_hasher ( ) ;
272
- val. hash ( & mut state) ;
273
- state. finish ( )
274
- }
275
-
276
- #[ cfg( feature = "nightly" ) ]
277
- #[ cfg_attr( feature = "inline-more" , inline) ]
278
- pub ( crate ) fn make_insert_hash < K , S > ( hash_builder : & S , val : & K ) -> u64
279
- where
280
- K : Hash ,
281
- S : BuildHasher ,
282
- {
283
- hash_builder. hash_one ( val)
284
- }
285
-
286
263
#[ cfg( feature = "ahash" ) ]
287
264
impl < K , V > HashMap < K , V , DefaultHashBuilder > {
288
265
/// Creates an empty `HashMap`.
@@ -1262,7 +1239,7 @@ where
1262
1239
/// ```
1263
1240
#[ cfg_attr( feature = "inline-more" , inline) ]
1264
1241
pub fn entry ( & mut self , key : K ) -> Entry < ' _ , K , V , S , A > {
1265
- let hash = make_insert_hash :: < K , S > ( & self . hash_builder , & key) ;
1242
+ let hash = make_hash :: < K , S > ( & self . hash_builder , & key) ;
1266
1243
if let Some ( elem) = self . table . find ( hash, equivalent_key ( & key) ) {
1267
1244
Entry :: Occupied ( OccupiedEntry {
1268
1245
hash,
@@ -1782,7 +1759,7 @@ where
1782
1759
/// ```
1783
1760
#[ cfg_attr( feature = "inline-more" , inline) ]
1784
1761
pub fn insert ( & mut self , k : K , v : V ) -> Option < V > {
1785
- let hash = make_insert_hash :: < K , S > ( & self . hash_builder , & k) ;
1762
+ let hash = make_hash :: < K , S > ( & self . hash_builder , & k) ;
1786
1763
let hasher = make_hasher :: < _ , V , S > ( & self . hash_builder ) ;
1787
1764
match self
1788
1765
. table
@@ -1849,7 +1826,7 @@ where
1849
1826
/// ```
1850
1827
#[ cfg_attr( feature = "inline-more" , inline) ]
1851
1828
pub fn insert_unique_unchecked ( & mut self , k : K , v : V ) -> ( & K , & mut V ) {
1852
- let hash = make_insert_hash :: < K , S > ( & self . hash_builder , & k) ;
1829
+ let hash = make_hash :: < K , S > ( & self . hash_builder , & k) ;
1853
1830
let bucket = self
1854
1831
. table
1855
1832
. insert ( hash, ( k, v) , make_hasher :: < _ , V , S > ( & self . hash_builder ) ) ;
@@ -4003,7 +3980,7 @@ impl<'a, K, V, S, A: Allocator + Clone> RawVacantEntryMut<'a, K, V, S, A> {
4003
3980
K : Hash ,
4004
3981
S : BuildHasher ,
4005
3982
{
4006
- let hash = make_insert_hash :: < K , S > ( self . hash_builder , & key) ;
3983
+ let hash = make_hash :: < K , S > ( self . hash_builder , & key) ;
4007
3984
self . insert_hashed_nocheck ( hash, key, value)
4008
3985
}
4009
3986
@@ -4111,7 +4088,7 @@ impl<'a, K, V, S, A: Allocator + Clone> RawVacantEntryMut<'a, K, V, S, A> {
4111
4088
K : Hash ,
4112
4089
S : BuildHasher ,
4113
4090
{
4114
- let hash = make_insert_hash :: < K , S > ( self . hash_builder , & key) ;
4091
+ let hash = make_hash :: < K , S > ( self . hash_builder , & key) ;
4115
4092
let elem = self . table . insert (
4116
4093
hash,
4117
4094
( key, value) ,
@@ -8194,7 +8171,7 @@ mod test_map {
8194
8171
let mut map: HashMap < _ , _ > = xs. iter ( ) . copied ( ) . collect ( ) ;
8195
8172
8196
8173
let compute_hash = |map : & HashMap < i32 , i32 > , k : i32 | -> u64 {
8197
- super :: make_insert_hash :: < i32 , _ > ( map. hasher ( ) , & k)
8174
+ super :: make_hash :: < i32 , _ > ( map. hasher ( ) , & k)
8198
8175
} ;
8199
8176
8200
8177
// Existing key (insert)
@@ -8356,7 +8333,7 @@ mod test_map {
8356
8333
loop {
8357
8334
// occasionally remove some elements
8358
8335
if i < n && rng. gen_bool ( 0.1 ) {
8359
- let hash_value = super :: make_insert_hash ( & hash_builder, & i) ;
8336
+ let hash_value = super :: make_hash ( & hash_builder, & i) ;
8360
8337
8361
8338
unsafe {
8362
8339
let e = map. table . find ( hash_value, |q| q. 0 . eq ( & i) ) ;
0 commit comments