Skip to content

Commit

Permalink
Rollup merge of rust-lang#136686 - bjoernager:master, r=jhpratt
Browse files Browse the repository at this point in the history
Clean up `HashMap` and `HashSet` docs.

This commit makes some small, pedantic changes to the docs for `HashMap` and `HashSet`, which fixes that:

* "HashMap" is not always formatted as code (as in `HashMap`), and that
* `HashSet` sometimes references `HashMap` instead of itself.
  • Loading branch information
workingjubilee authored Feb 8, 2025
2 parents 540d098 + 450b864 commit a8675ae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions library/std/src/collections/hash/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ impl<K, V, S> HashMap<K, V, S> {
/// manually using this function can expose a DoS attack vector.
///
/// The `hash_builder` passed should implement the [`BuildHasher`] trait for
/// the HashMap to be useful, see its documentation for details.
/// the `HashMap` to be useful, see its documentation for details.
///
/// # Examples
///
Expand Down Expand Up @@ -314,7 +314,7 @@ impl<K, V, S> HashMap<K, V, S> {
/// manually using this function can expose a DoS attack vector.
///
/// The `hasher` passed should implement the [`BuildHasher`] trait for
/// the HashMap to be useful, see its documentation for details.
/// the `HashMap` to be useful, see its documentation for details.
///
/// # Examples
///
Expand Down Expand Up @@ -1283,7 +1283,7 @@ impl<K, V, S> HashMap<K, V, S>
where
S: BuildHasher,
{
/// Creates a raw entry builder for the HashMap.
/// Creates a raw entry builder for the `HashMap`.
///
/// Raw entries provide the lowest level of control for searching and
/// manipulating a map. They must be manually initialized with a hash and
Expand All @@ -1298,13 +1298,13 @@ where
/// * Using custom comparison logic without newtype wrappers
///
/// Because raw entries provide much more low-level control, it's much easier
/// to put the HashMap into an inconsistent state which, while memory-safe,
/// to put the `HashMap` into an inconsistent state which, while memory-safe,
/// will cause the map to produce seemingly random results. Higher-level and
/// more foolproof APIs like `entry` should be preferred when possible.
///
/// In particular, the hash used to initialize the raw entry must still be
/// consistent with the hash of the key that is ultimately stored in the entry.
/// This is because implementations of HashMap may need to recompute hashes
/// This is because implementations of `HashMap` may need to recompute hashes
/// when resizing, at which point only the keys are available.
///
/// Raw entries give mutable access to the keys. This must not be used
Expand All @@ -1320,7 +1320,7 @@ where
RawEntryBuilderMut { map: self }
}

/// Creates a raw immutable entry builder for the HashMap.
/// Creates a raw immutable entry builder for the `HashMap`.
///
/// Raw entries provide the lowest level of control for searching and
/// manipulating a map. They must be manually initialized with a hash and
Expand Down
4 changes: 2 additions & 2 deletions library/std/src/collections/hash/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ impl<T, S> HashSet<T, S> {
/// manually using this function can expose a DoS attack vector.
///
/// The `hash_builder` passed should implement the [`BuildHasher`] trait for
/// the HashMap to be useful, see its documentation for details.
/// the `HashSet` to be useful, see its documentation for details.
///
/// # Examples
///
Expand Down Expand Up @@ -406,7 +406,7 @@ impl<T, S> HashSet<T, S> {
/// manually using this function can expose a DoS attack vector.
///
/// The `hash_builder` passed should implement the [`BuildHasher`] trait for
/// the HashMap to be useful, see its documentation for details.
/// the `HashSet` to be useful, see its documentation for details.
///
/// # Examples
///
Expand Down

0 comments on commit a8675ae

Please sign in to comment.