Skip to content

Commit daf5bd5

Browse files
committed
A couple suggested edits
1 parent a92594d commit daf5bd5

File tree

1 file changed

+3
-7
lines changed
  • src/libstd/collections/hash

1 file changed

+3
-7
lines changed

src/libstd/collections/hash/map.rs

+3-7
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ fn search_hashed_nonempty<K, V, M, F>(table: M, hash: SafeHash, mut is_match: F,
477477
}
478478

479479
// If the hash doesn't match, it can't be this one..
480-
if hash == full.hash() || !compare_hashes {
480+
if !compare_hashes || hash == full.hash() {
481481
// If the key doesn't match, it can't be this one..
482482
if is_match(full.read().0) {
483483
return InternalEntry::Occupied { elem: full };
@@ -489,7 +489,7 @@ fn search_hashed_nonempty<K, V, M, F>(table: M, hash: SafeHash, mut is_match: F,
489489
}
490490
}
491491

492-
/// Search for a pre-hashed key when the hash map is known to be non-empty.
492+
/// Same as `search_hashed_nonempty` but for mutable access.
493493
#[inline]
494494
fn search_hashed_nonempty_mut<K, V, M, F>(table: M, hash: SafeHash, mut is_match: F,
495495
compare_hashes: bool)
@@ -1571,10 +1571,6 @@ impl<K, V, S> HashMap<K, V, S>
15711571
/// so that the map now contains keys which compare equal, search may start
15721572
/// acting eratically, with two keys randomly masking eachother. Implementations
15731573
/// are free to assume this doesn't happen (within the limits of memory-safety).
1574-
///
1575-
/// # Examples
1576-
///
1577-
///
15781574
#[unstable(feature = "hash_raw_entry", issue = "54043")]
15791575
pub fn raw_entry_mut(&mut self) -> RawEntryBuilderMut<K, V, S> {
15801576
self.reserve(1);
@@ -1595,7 +1591,7 @@ impl<K, V, S> HashMap<K, V, S>
15951591
/// Unless you are in such a situation, higher-level and more foolproof APIs like
15961592
/// `get` should be preferred.
15971593
///
1598-
/// Immutable raw entries have very limited use; you might instead want `raw_entry`.
1594+
/// Immutable raw entries have very limited use; you might instead want `raw_entry_mut`.
15991595
#[unstable(feature = "hash_raw_entry", issue = "54043")]
16001596
pub fn raw_entry(&self) -> RawEntryBuilder<K, V, S> {
16011597
RawEntryBuilder { map: self }

0 commit comments

Comments
 (0)