Skip to content

Commit 29f7148

Browse files
committed
38880 remove redundant extra function
1 parent dcdd2c4 commit 29f7148

File tree

1 file changed

+6
-14
lines changed
  • src/libstd/collections/hash

1 file changed

+6
-14
lines changed

src/libstd/collections/hash/map.rs

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -397,17 +397,6 @@ pub struct HashMap<K, V, S = RandomState> {
397397
resize_policy: DefaultResizePolicy,
398398
}
399399

400-
/// Search for a pre-hashed key when the hash map is known to be non-empty.
401-
#[inline]
402-
fn search_hashed_nonempty<K, V, M, F>(table: M, hash: SafeHash, is_match: F)
403-
-> InternalEntry<K, V, M>
404-
where M: Deref<Target = RawTable<K, V>>,
405-
F: FnMut(&K) -> bool
406-
{
407-
// Do not check the capacity as an extra branch could slow the lookup.
408-
search_hashed_body(table, hash, is_match)
409-
}
410-
411400
/// Search for a pre-hashed key.
412401
/// If you don't already know the hash, use search or search_mut instead
413402
#[inline]
@@ -422,16 +411,19 @@ fn search_hashed<K, V, M, F>(table: M, hash: SafeHash, is_match: F) -> InternalE
422411
return InternalEntry::TableIsEmpty;
423412
}
424413

425-
search_hashed_body(table, hash, is_match)
414+
search_hashed_nonempty(table, hash, is_match)
426415
}
427416

428-
/// The body of the search_hashed[_nonempty] functions
417+
418+
/// Search for a pre-hashed key when the hash map is known to be non-empty.
429419
#[inline]
430-
fn search_hashed_body<K, V, M, F>(table: M, hash: SafeHash, mut is_match: F)
420+
fn search_hashed_nonempty<K, V, M, F>(table: M, hash: SafeHash, is_match: F)
431421
-> InternalEntry<K, V, M>
432422
where M: Deref<Target = RawTable<K, V>>,
433423
F: FnMut(&K) -> bool
434424
{
425+
// Do not check the capacity as an extra branch could slow the lookup.
426+
435427
let size = table.size();
436428
let mut probe = Bucket::new(table, hash);
437429
let mut displacement = 0;

0 commit comments

Comments
 (0)