Skip to content

Commit

Permalink
docs: Add missing backticks.
Browse files Browse the repository at this point in the history
  • Loading branch information
waywardmonkeys committed Sep 17, 2024
1 parent 0011336 commit 53a54c7
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 30 deletions.
14 changes: 7 additions & 7 deletions src/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ impl<K: Clone, V: Clone, S: Clone, A: Allocator + Clone> Clone for HashMap<K, V,
}

/// Ensures that a single closure type across uses of this which, in turn prevents multiple
/// instances of any functions like RawTable::reserve from being generated
/// instances of any functions like `RawTable::reserve` from being generated
#[cfg_attr(feature = "inline-more", inline)]
pub(crate) fn make_hasher<Q, V, S>(hash_builder: &S) -> impl Fn(&(Q, V)) -> u64 + '_
where
Expand All @@ -215,7 +215,7 @@ where
}

/// Ensures that a single closure type across uses of this which, in turn prevents multiple
/// instances of any functions like RawTable::reserve from being generated
/// instances of any functions like `RawTable::reserve` from being generated
#[cfg_attr(feature = "inline-more", inline)]
pub(crate) fn equivalent_key<Q, K, V>(k: &Q) -> impl Fn(&(K, V)) -> bool + '_
where
Expand All @@ -225,7 +225,7 @@ where
}

/// Ensures that a single closure type across uses of this which, in turn prevents multiple
/// instances of any functions like RawTable::reserve from being generated
/// instances of any functions like `RawTable::reserve` from being generated
#[cfg_attr(feature = "inline-more", inline)]
#[allow(dead_code)]
pub(crate) fn equivalent<Q, K>(k: &Q) -> impl Fn(&K) -> bool + '_
Expand Down Expand Up @@ -433,7 +433,7 @@ impl<K, V, S> HashMap<K, V, S> {
/// as the hasher when creating a [`HashMap`].
///
/// 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.
///
/// [`HashDoS`]: https://en.wikipedia.org/wiki/Collision_attack
/// [`std::collections::hash_map::RandomState`]: https://doc.rust-lang.org/std/collections/hash_map/struct.RandomState.html
Expand Down Expand Up @@ -475,7 +475,7 @@ impl<K, V, S> HashMap<K, V, S> {
/// as the hasher when creating a [`HashMap`].
///
/// 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.
///
/// [`HashDoS`]: https://en.wikipedia.org/wiki/Collision_attack
/// [`std::collections::hash_map::RandomState`]: https://doc.rust-lang.org/std/collections/hash_map/struct.RandomState.html
Expand Down Expand Up @@ -3774,7 +3774,7 @@ impl<'a, K, V, S, A: Allocator> OccupiedEntry<'a, K, V, S, A> {
unsafe { &mut self.elem.as_mut().1 }
}

/// Converts the OccupiedEntry into a mutable reference to the value in the entry
/// Converts the `OccupiedEntry` into a mutable reference to the value in the entry
/// with a lifetime bound to the map itself.
///
/// If you need multiple references to the `OccupiedEntry`, see [`get_mut`].
Expand Down Expand Up @@ -4270,7 +4270,7 @@ impl<'a, 'b, K, Q: ?Sized, V, S, A: Allocator> VacantEntryRef<'a, 'b, K, Q, V, S
self.key
}

/// Sets the value of the entry with the VacantEntryRef's key,
/// Sets the value of the entry with the `VacantEntryRef`'s key,
/// and returns a mutable reference to it.
///
/// # Examples
Expand Down
10 changes: 5 additions & 5 deletions src/raw/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ fn bucket_mask_to_capacity(bucket_mask: usize) -> usize {
}
}

/// Helper which allows the max calculation for ctrl_align to be statically computed for each T
/// Helper which allows the max calculation for `ctrl_align` to be statically computed for each `T`
/// while keeping the rest of `calculate_layout_for` independent of `T`
#[derive(Copy, Clone)]
struct TableLayout {
Expand Down Expand Up @@ -2582,7 +2582,7 @@ impl RawTableInner {

/// Attempts to allocate a new hash table with at least enough capacity
/// for inserting the given number of elements without reallocating,
/// and return it inside ScopeGuard to protect against panic in the hash
/// and return it inside `ScopeGuard` to protect against panic in the hash
/// function.
///
/// # Note
Expand Down Expand Up @@ -3294,7 +3294,7 @@ impl<T: Copy, A: Allocator + Clone> RawTableClone for RawTable<T, A> {
}

impl<T: Clone, A: Allocator + Clone> RawTable<T, A> {
/// Common code for clone and clone_from. Assumes:
/// Common code for `clone` and `clone_from`. Assumes:
/// - `self.buckets() == source.buckets()`.
/// - Any existing elements have been dropped.
/// - The control bytes are not initialized yet.
Expand Down Expand Up @@ -3419,7 +3419,7 @@ impl<T> RawIterRange<T> {
///
/// * `ctrl` must be [valid] for reads, i.e. table outlives the `RawIterRange`;
///
/// * `ctrl` must be properly aligned to the group size (Group::WIDTH);
/// * `ctrl` must be properly aligned to the group size (`Group::WIDTH`);
///
/// * `ctrl` must point to the array of properly initialized control bytes;
///
Expand Down Expand Up @@ -3501,7 +3501,7 @@ impl<T> RawIterRange<T> {
}

/// # Safety
/// If DO_CHECK_PTR_RANGE is false, caller must ensure that we never try to iterate
/// If `DO_CHECK_PTR_RANGE` is false, caller must ensure that we never try to iterate
/// after yielding all elements.
#[cfg_attr(feature = "inline-more", inline)]
unsafe fn next_impl<const DO_CHECK_PTR_RANGE: bool>(&mut self) -> Option<Bucket<T>> {
Expand Down
18 changes: 9 additions & 9 deletions src/raw_entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use core::hash::{BuildHasher, Hash};
use core::mem;

impl<K, V, S, A: Allocator> HashMap<K, V, S, A> {
/// 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 @@ -21,13 +21,13 @@ impl<K, V, S, A: Allocator> HashMap<K, V, S, A> {
/// * 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 initialized 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 Down Expand Up @@ -108,7 +108,7 @@ impl<K, V, S, A: Allocator> HashMap<K, V, S, A> {
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 Expand Up @@ -708,7 +708,7 @@ impl<'a, K, V, S, A: Allocator> RawEntryBuilder<'a, K, V, S, A> {
}

impl<'a, K, V, S, A: Allocator> RawEntryMut<'a, K, V, S, A> {
/// Sets the value of the entry, and returns a RawOccupiedEntryMut.
/// Sets the value of the entry, and returns a `RawOccupiedEntryMut`.
///
/// # Examples
///
Expand Down Expand Up @@ -1005,7 +1005,7 @@ impl<'a, K, V, S, A: Allocator> RawOccupiedEntryMut<'a, K, V, S, A> {
unsafe { &self.elem.as_ref().1 }
}

/// Converts the OccupiedEntry into a mutable reference to the value in the entry
/// Converts the `OccupiedEntry` into a mutable reference to the value in the entry
/// with a lifetime bound to the map itself.
///
/// # Examples
Expand Down Expand Up @@ -1109,7 +1109,7 @@ impl<'a, K, V, S, A: Allocator> RawOccupiedEntryMut<'a, K, V, S, A> {
}
}

/// Converts the OccupiedEntry into a mutable reference to the key and value in the entry
/// Converts the `OccupiedEntry` into a mutable reference to the key and value in the entry
/// with a lifetime bound to the map itself.
///
/// # Examples
Expand Down Expand Up @@ -1301,7 +1301,7 @@ impl<'a, K, V, S, A: Allocator> RawOccupiedEntryMut<'a, K, V, S, A> {
}

impl<'a, K, V, S, A: Allocator> RawVacantEntryMut<'a, K, V, S, A> {
/// Sets the value of the entry with the VacantEntry's key,
/// Sets the value of the entry with the `VacantEntry`'s key,
/// and returns a mutable reference to it.
///
/// # Examples
Expand All @@ -1328,7 +1328,7 @@ impl<'a, K, V, S, A: Allocator> RawVacantEntryMut<'a, K, V, S, A> {
self.insert_hashed_nocheck(hash, key, value)
}

/// Sets the value of the entry with the VacantEntry's key,
/// Sets the value of the entry with the `VacantEntry`'s key,
/// and returns a mutable reference to it.
///
/// # Examples
Expand Down
10 changes: 5 additions & 5 deletions src/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ impl<T, S> HashSet<T, S, Global> {
/// as the hasher when creating a [`HashSet`].
///
/// The `hash_builder` passed should implement the [`BuildHasher`] trait for
/// the HashSet to be useful, see its documentation for details.
/// the `HashSet` to be useful, see its documentation for details.
///
/// [`HashDoS`]: https://en.wikipedia.org/wiki/Collision_attack
/// [`std::collections::hash_map::RandomState`]: https://doc.rust-lang.org/std/collections/hash_map/struct.RandomState.html
Expand Down Expand Up @@ -487,7 +487,7 @@ impl<T, S> HashSet<T, S, Global> {
/// as the hasher when creating a [`HashSet`].
///
/// The `hash_builder` passed should implement the [`BuildHasher`] trait for
/// the HashSet to be useful, see its documentation for details.
/// the `HashSet` to be useful, see its documentation for details.
///
/// [`HashDoS`]: https://en.wikipedia.org/wiki/Collision_attack
/// [`std::collections::hash_map::RandomState`]: https://doc.rust-lang.org/std/collections/hash_map/struct.RandomState.html
Expand Down Expand Up @@ -536,7 +536,7 @@ where
/// as the hasher when creating a [`HashSet`].
///
/// The `hash_builder` passed should implement the [`BuildHasher`] trait for
/// the HashSet to be useful, see its documentation for details.
/// the `HashSet` to be useful, see its documentation for details.
///
/// [`HashDoS`]: https://en.wikipedia.org/wiki/Collision_attack
/// [`std::collections::hash_map::RandomState`]: https://doc.rust-lang.org/std/collections/hash_map/struct.RandomState.html
Expand Down Expand Up @@ -574,7 +574,7 @@ where
/// as the hasher when creating a [`HashSet`].
///
/// The `hash_builder` passed should implement the [`BuildHasher`] trait for
/// the HashSet to be useful, see its documentation for details.
/// the `HashSet` to be useful, see its documentation for details.
///
/// [`HashDoS`]: https://en.wikipedia.org/wiki/Collision_attack
/// [`std::collections::hash_map::RandomState`]: https://doc.rust-lang.org/std/collections/hash_map/struct.RandomState.html
Expand Down Expand Up @@ -2523,7 +2523,7 @@ impl<'a, T, S, A: Allocator> VacantEntry<'a, T, S, A> {
self.inner.into_key()
}

/// Sets the value of the entry with the VacantEntry's value.
/// Sets the value of the entry with the `VacantEntry`'s value.
///
/// # Examples
///
Expand Down
8 changes: 4 additions & 4 deletions src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1681,7 +1681,7 @@ where
unsafe { self.bucket.as_mut() }
}

/// Converts the OccupiedEntry into a mutable reference to the value in the entry
/// Converts the `OccupiedEntry` into a mutable reference to the value in the entry
/// with a lifetime bound to the table itself.
///
/// If you need multiple references to the `OccupiedEntry`, see [`get_mut`].
Expand Down Expand Up @@ -1732,7 +1732,7 @@ where
unsafe { self.bucket.as_mut() }
}

/// Converts the OccupiedEntry into a mutable reference to the underlying
/// Converts the `OccupiedEntry` into a mutable reference to the underlying
/// table.
pub fn into_table(self) -> &'a mut HashTable<T, A> {
self.table
Expand Down Expand Up @@ -1842,7 +1842,7 @@ where
}
}

/// Converts the VacantEntry into a mutable reference to the underlying
/// Converts the `VacantEntry` into a mutable reference to the underlying
/// table.
pub fn into_table(self) -> &'a mut HashTable<T, A> {
self.table
Expand Down Expand Up @@ -1907,7 +1907,7 @@ impl<'a, T, A> AbsentEntry<'a, T, A>
where
A: Allocator,
{
/// Converts the AbsentEntry into a mutable reference to the underlying
/// Converts the `AbsentEntry` into a mutable reference to the underlying
/// table.
pub fn into_table(self) -> &'a mut HashTable<T, A> {
self.table
Expand Down

0 comments on commit 53a54c7

Please sign in to comment.