From 53a54c7134e32c532adcc93b76fa12ce95359ae4 Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Tue, 17 Sep 2024 23:33:28 +0700 Subject: [PATCH] docs: Add missing backticks. --- src/map.rs | 14 +++++++------- src/raw/mod.rs | 10 +++++----- src/raw_entry.rs | 18 +++++++++--------- src/set.rs | 10 +++++----- src/table.rs | 8 ++++---- 5 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/map.rs b/src/map.rs index 82be17ad6..dce63d008 100644 --- a/src/map.rs +++ b/src/map.rs @@ -204,7 +204,7 @@ impl Clone for HashMap(hash_builder: &S) -> impl Fn(&(Q, V)) -> u64 + '_ where @@ -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(k: &Q) -> impl Fn(&(K, V)) -> bool + '_ where @@ -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(k: &Q) -> impl Fn(&K) -> bool + '_ @@ -433,7 +433,7 @@ impl HashMap { /// 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 @@ -475,7 +475,7 @@ impl HashMap { /// 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 @@ -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`]. @@ -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 diff --git a/src/raw/mod.rs b/src/raw/mod.rs index 5321a6eb1..3612c34de 100644 --- a/src/raw/mod.rs +++ b/src/raw/mod.rs @@ -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 { @@ -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 @@ -3294,7 +3294,7 @@ impl RawTableClone for RawTable { } impl RawTable { - /// 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. @@ -3419,7 +3419,7 @@ impl RawIterRange { /// /// * `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; /// @@ -3501,7 +3501,7 @@ impl RawIterRange { } /// # 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(&mut self) -> Option> { diff --git a/src/raw_entry.rs b/src/raw_entry.rs index 99fef6fa9..480ebdbe1 100644 --- a/src/raw_entry.rs +++ b/src/raw_entry.rs @@ -6,7 +6,7 @@ use core::hash::{BuildHasher, Hash}; use core::mem; impl HashMap { - /// 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 @@ -21,13 +21,13 @@ impl HashMap { /// * 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 @@ -108,7 +108,7 @@ impl HashMap { 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 @@ -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 /// @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/src/set.rs b/src/set.rs index e5e9496ae..34b8ef279 100644 --- a/src/set.rs +++ b/src/set.rs @@ -449,7 +449,7 @@ impl HashSet { /// 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 @@ -487,7 +487,7 @@ impl HashSet { /// 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 @@ -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 @@ -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 @@ -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 /// diff --git a/src/table.rs b/src/table.rs index 421f52ca3..fd17959e7 100644 --- a/src/table.rs +++ b/src/table.rs @@ -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`]. @@ -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 { self.table @@ -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 { self.table @@ -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 { self.table