diff options
| author | Shaun Steenkamp <theguywholikeslinux@gmail.com> | 2018-02-12 14:00:08 +0000 |
|---|---|---|
| committer | Shaun Steenkamp <theguywholikeslinux@gmail.com> | 2018-02-12 14:00:08 +0000 |
| commit | 29f71488bc50843b65660867ab41e6ebf1101e6e (patch) | |
| tree | a21e962cc5f3fc850056d5a999f185e6675c64ed /src/libstd/collections | |
| parent | dcdd2c42d3c7f6125583bcdf0c5ed7e1ef7086db (diff) | |
| download | rust-29f71488bc50843b65660867ab41e6ebf1101e6e.tar.gz rust-29f71488bc50843b65660867ab41e6ebf1101e6e.zip | |
38880 remove redundant extra function
Diffstat (limited to 'src/libstd/collections')
| -rw-r--r-- | src/libstd/collections/hash/map.rs | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index 04c9f617d01..d798854927d 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -397,17 +397,6 @@ pub struct HashMap<K, V, S = RandomState> { resize_policy: DefaultResizePolicy, } -/// Search for a pre-hashed key when the hash map is known to be non-empty. -#[inline] -fn search_hashed_nonempty<K, V, M, F>(table: M, hash: SafeHash, is_match: F) - -> InternalEntry<K, V, M> - where M: Deref<Target = RawTable<K, V>>, - F: FnMut(&K) -> bool -{ - // Do not check the capacity as an extra branch could slow the lookup. - search_hashed_body(table, hash, is_match) -} - /// Search for a pre-hashed key. /// If you don't already know the hash, use search or search_mut instead #[inline] @@ -422,16 +411,19 @@ fn search_hashed<K, V, M, F>(table: M, hash: SafeHash, is_match: F) -> InternalE return InternalEntry::TableIsEmpty; } - search_hashed_body(table, hash, is_match) + search_hashed_nonempty(table, hash, is_match) } -/// The body of the search_hashed[_nonempty] functions + +/// Search for a pre-hashed key when the hash map is known to be non-empty. #[inline] -fn search_hashed_body<K, V, M, F>(table: M, hash: SafeHash, mut is_match: F) +fn search_hashed_nonempty<K, V, M, F>(table: M, hash: SafeHash, is_match: F) -> InternalEntry<K, V, M> where M: Deref<Target = RawTable<K, V>>, F: FnMut(&K) -> bool { + // Do not check the capacity as an extra branch could slow the lookup. + let size = table.size(); let mut probe = Bucket::new(table, hash); let mut displacement = 0; |
