Skip to content

Commit e53fea7

Browse files
committed
Use intra-doc links on HashMap
1 parent 26ba0e1 commit e53fea7

File tree

2 files changed

+19
-69
lines changed

2 files changed

+19
-69
lines changed

src/libstd/collections/hash/map.rs

+19-68
Original file line numberDiff line numberDiff line change
@@ -148,14 +148,11 @@ use crate::sys;
148148
/// The easiest way to use `HashMap` with a custom key type is to derive [`Eq`] and [`Hash`].
149149
/// We must also derive [`PartialEq`].
150150
///
151-
/// [`Eq`]: ../../std/cmp/trait.Eq.html
152-
/// [`Hash`]: ../../std/hash/trait.Hash.html
153-
/// [`PartialEq`]: ../../std/cmp/trait.PartialEq.html
154-
/// [`RefCell`]: ../../std/cell/struct.RefCell.html
155-
/// [`Cell`]: ../../std/cell/struct.Cell.html
156-
/// [`default`]: #method.default
157-
/// [`with_hasher`]: #method.with_hasher
158-
/// [`with_capacity_and_hasher`]: #method.with_capacity_and_hasher
151+
/// [`RefCell`]: crate::cell::RefCell
152+
/// [`Cell`]: crate::cell::Cell
153+
/// [`default`]: Default::default
154+
/// [`with_hasher`]: Self::with_hasher
155+
/// [`with_capacity_and_hasher`]: Self::with_capacity_and_hasher
159156
/// [`fnv`]: https://crates.io/crates/fnv
160157
///
161158
/// ```
@@ -264,8 +261,6 @@ impl<K, V, S> HashMap<K, V, S> {
264261
/// let mut map = HashMap::with_hasher(s);
265262
/// map.insert(1, 2);
266263
/// ```
267-
///
268-
/// [`BuildHasher`]: ../../std/hash/trait.BuildHasher.html
269264
#[inline]
270265
#[stable(feature = "hashmap_build_hasher", since = "1.7.0")]
271266
pub fn with_hasher(hash_builder: S) -> HashMap<K, V, S> {
@@ -296,8 +291,6 @@ impl<K, V, S> HashMap<K, V, S> {
296291
/// let mut map = HashMap::with_capacity_and_hasher(10, s);
297292
/// map.insert(1, 2);
298293
/// ```
299-
///
300-
/// [`BuildHasher`]: ../../std/hash/trait.BuildHasher.html
301294
#[inline]
302295
#[stable(feature = "hashmap_build_hasher", since = "1.7.0")]
303296
pub fn with_capacity_and_hasher(capacity: usize, hash_builder: S) -> HashMap<K, V, S> {
@@ -524,8 +517,6 @@ impl<K, V, S> HashMap<K, V, S> {
524517

525518
/// Returns a reference to the map's [`BuildHasher`].
526519
///
527-
/// [`BuildHasher`]: ../../std/hash/trait.BuildHasher.html
528-
///
529520
/// # Examples
530521
///
531522
/// ```
@@ -556,8 +547,6 @@ where
556547
///
557548
/// Panics if the new allocation size overflows [`usize`].
558549
///
559-
/// [`usize`]: ../../std/primitive.usize.html
560-
///
561550
/// # Examples
562551
///
563552
/// ```
@@ -676,9 +665,6 @@ where
676665
/// [`Hash`] and [`Eq`] on the borrowed form *must* match those for
677666
/// the key type.
678667
///
679-
/// [`Eq`]: ../../std/cmp/trait.Eq.html
680-
/// [`Hash`]: ../../std/hash/trait.Hash.html
681-
///
682668
/// # Examples
683669
///
684670
/// ```
@@ -705,9 +691,6 @@ where
705691
/// [`Hash`] and [`Eq`] on the borrowed form *must* match those for
706692
/// the key type.
707693
///
708-
/// [`Eq`]: ../../std/cmp/trait.Eq.html
709-
/// [`Hash`]: ../../std/hash/trait.Hash.html
710-
///
711694
/// # Examples
712695
///
713696
/// ```
@@ -734,9 +717,6 @@ where
734717
/// [`Hash`] and [`Eq`] on the borrowed form *must* match those for
735718
/// the key type.
736719
///
737-
/// [`Eq`]: ../../std/cmp/trait.Eq.html
738-
/// [`Hash`]: ../../std/hash/trait.Hash.html
739-
///
740720
/// # Examples
741721
///
742722
/// ```
@@ -763,9 +743,6 @@ where
763743
/// [`Hash`] and [`Eq`] on the borrowed form *must* match those for
764744
/// the key type.
765745
///
766-
/// [`Eq`]: ../../std/cmp/trait.Eq.html
767-
/// [`Hash`]: ../../std/hash/trait.Hash.html
768-
///
769746
/// # Examples
770747
///
771748
/// ```
@@ -797,8 +774,7 @@ where
797774
/// types that can be `==` without being identical. See the [module-level
798775
/// documentation] for more.
799776
///
800-
/// [`None`]: ../../std/option/enum.Option.html#variant.None
801-
/// [module-level documentation]: index.html#insert-and-complex-keys
777+
/// [module-level documentation]: crate::collections#insert-and-complex-keys
802778
///
803779
/// # Examples
804780
///
@@ -826,9 +802,6 @@ where
826802
/// [`Hash`] and [`Eq`] on the borrowed form *must* match those for
827803
/// the key type.
828804
///
829-
/// [`Eq`]: ../../std/cmp/trait.Eq.html
830-
/// [`Hash`]: ../../std/hash/trait.Hash.html
831-
///
832805
/// # Examples
833806
///
834807
/// ```
@@ -856,9 +829,6 @@ where
856829
/// [`Hash`] and [`Eq`] on the borrowed form *must* match those for
857830
/// the key type.
858831
///
859-
/// [`Eq`]: ../../std/cmp/trait.Eq.html
860-
/// [`Hash`]: ../../std/hash/trait.Hash.html
861-
///
862832
/// # Examples
863833
///
864834
/// ```
@@ -1040,8 +1010,7 @@ where
10401010
/// This `struct` is created by the [`iter`] method on [`HashMap`]. See its
10411011
/// documentation for more.
10421012
///
1043-
/// [`iter`]: struct.HashMap.html#method.iter
1044-
/// [`HashMap`]: struct.HashMap.html
1013+
/// [`iter`]: HashMap::iter
10451014
#[stable(feature = "rust1", since = "1.0.0")]
10461015
pub struct Iter<'a, K: 'a, V: 'a> {
10471016
base: base::Iter<'a, K, V>,
@@ -1068,8 +1037,7 @@ impl<K: Debug, V: Debug> fmt::Debug for Iter<'_, K, V> {
10681037
/// This `struct` is created by the [`iter_mut`] method on [`HashMap`]. See its
10691038
/// documentation for more.
10701039
///
1071-
/// [`iter_mut`]: struct.HashMap.html#method.iter_mut
1072-
/// [`HashMap`]: struct.HashMap.html
1040+
/// [`iter_mut`]: HashMap::iter_mut
10731041
#[stable(feature = "rust1", since = "1.0.0")]
10741042
pub struct IterMut<'a, K: 'a, V: 'a> {
10751043
base: base::IterMut<'a, K, V>,
@@ -1088,8 +1056,7 @@ impl<'a, K, V> IterMut<'a, K, V> {
10881056
/// This `struct` is created by the [`into_iter`] method on [`HashMap`]
10891057
/// (provided by the `IntoIterator` trait). See its documentation for more.
10901058
///
1091-
/// [`into_iter`]: struct.HashMap.html#method.into_iter
1092-
/// [`HashMap`]: struct.HashMap.html
1059+
/// [`into_iter`]: IntoIterator::into_iter
10931060
#[stable(feature = "rust1", since = "1.0.0")]
10941061
pub struct IntoIter<K, V> {
10951062
base: base::IntoIter<K, V>,
@@ -1108,8 +1075,7 @@ impl<K, V> IntoIter<K, V> {
11081075
/// This `struct` is created by the [`keys`] method on [`HashMap`]. See its
11091076
/// documentation for more.
11101077
///
1111-
/// [`keys`]: struct.HashMap.html#method.keys
1112-
/// [`HashMap`]: struct.HashMap.html
1078+
/// [`keys`]: HashMap::keys
11131079
#[stable(feature = "rust1", since = "1.0.0")]
11141080
pub struct Keys<'a, K: 'a, V: 'a> {
11151081
inner: Iter<'a, K, V>,
@@ -1136,8 +1102,7 @@ impl<K: Debug, V> fmt::Debug for Keys<'_, K, V> {
11361102
/// This `struct` is created by the [`values`] method on [`HashMap`]. See its
11371103
/// documentation for more.
11381104
///
1139-
/// [`values`]: struct.HashMap.html#method.values
1140-
/// [`HashMap`]: struct.HashMap.html
1105+
/// [`values`]: HashMap::values
11411106
#[stable(feature = "rust1", since = "1.0.0")]
11421107
pub struct Values<'a, K: 'a, V: 'a> {
11431108
inner: Iter<'a, K, V>,
@@ -1164,8 +1129,7 @@ impl<K, V: Debug> fmt::Debug for Values<'_, K, V> {
11641129
/// This `struct` is created by the [`drain`] method on [`HashMap`]. See its
11651130
/// documentation for more.
11661131
///
1167-
/// [`drain`]: struct.HashMap.html#method.drain
1168-
/// [`HashMap`]: struct.HashMap.html
1132+
/// [`drain`]: HashMap::drain
11691133
#[stable(feature = "drain", since = "1.6.0")]
11701134
pub struct Drain<'a, K: 'a, V: 'a> {
11711135
base: base::Drain<'a, K, V>,
@@ -1184,8 +1148,7 @@ impl<'a, K, V> Drain<'a, K, V> {
11841148
/// This `struct` is created by the [`values_mut`] method on [`HashMap`]. See its
11851149
/// documentation for more.
11861150
///
1187-
/// [`values_mut`]: struct.HashMap.html#method.values_mut
1188-
/// [`HashMap`]: struct.HashMap.html
1151+
/// [`values_mut`]: HashMap::values_mut
11891152
#[stable(feature = "map_values_mut", since = "1.10.0")]
11901153
pub struct ValuesMut<'a, K: 'a, V: 'a> {
11911154
inner: IterMut<'a, K, V>,
@@ -1195,7 +1158,7 @@ pub struct ValuesMut<'a, K: 'a, V: 'a> {
11951158
///
11961159
/// See the [`HashMap::raw_entry_mut`] docs for usage examples.
11971160
///
1198-
/// [`HashMap::raw_entry_mut`]: struct.HashMap.html#method.raw_entry_mut
1161+
/// [`HashMap::raw_entry_mut`]: HashMap::raw_entry_mut
11991162
12001163
#[unstable(feature = "hash_raw_entry", issue = "56167")]
12011164
pub struct RawEntryBuilderMut<'a, K: 'a, V: 'a, S: 'a> {
@@ -1209,9 +1172,8 @@ pub struct RawEntryBuilderMut<'a, K: 'a, V: 'a, S: 'a> {
12091172
/// This `enum` is constructed through the [`raw_entry_mut`] method on [`HashMap`],
12101173
/// then calling one of the methods of that [`RawEntryBuilderMut`].
12111174
///
1212-
/// [`HashMap`]: struct.HashMap.html
12131175
/// [`Entry`]: enum.Entry.html
1214-
/// [`raw_entry_mut`]: struct.HashMap.html#method.raw_entry_mut
1176+
/// [`raw_entry_mut`]: HashMap::raw_entry_mut
12151177
/// [`RawEntryBuilderMut`]: struct.RawEntryBuilderMut.html
12161178
#[unstable(feature = "hash_raw_entry", issue = "56167")]
12171179
pub enum RawEntryMut<'a, K: 'a, V: 'a, S: 'a> {
@@ -1223,17 +1185,13 @@ pub enum RawEntryMut<'a, K: 'a, V: 'a, S: 'a> {
12231185

12241186
/// A view into an occupied entry in a `HashMap`.
12251187
/// It is part of the [`RawEntryMut`] enum.
1226-
///
1227-
/// [`RawEntryMut`]: enum.RawEntryMut.html
12281188
#[unstable(feature = "hash_raw_entry", issue = "56167")]
12291189
pub struct RawOccupiedEntryMut<'a, K: 'a, V: 'a> {
12301190
base: base::RawOccupiedEntryMut<'a, K, V>,
12311191
}
12321192

12331193
/// A view into a vacant entry in a `HashMap`.
12341194
/// It is part of the [`RawEntryMut`] enum.
1235-
///
1236-
/// [`RawEntryMut`]: enum.RawEntryMut.html
12371195
#[unstable(feature = "hash_raw_entry", issue = "56167")]
12381196
pub struct RawVacantEntryMut<'a, K: 'a, V: 'a, S: 'a> {
12391197
base: base::RawVacantEntryMut<'a, K, V, S>,
@@ -1243,7 +1201,7 @@ pub struct RawVacantEntryMut<'a, K: 'a, V: 'a, S: 'a> {
12431201
///
12441202
/// See the [`HashMap::raw_entry`] docs for usage examples.
12451203
///
1246-
/// [`HashMap::raw_entry`]: struct.HashMap.html#method.raw_entry
1204+
/// [`HashMap::raw_entry`]: HashMap::raw_entry
12471205
#[unstable(feature = "hash_raw_entry", issue = "56167")]
12481206
pub struct RawEntryBuilder<'a, K: 'a, V: 'a, S: 'a> {
12491207
map: &'a HashMap<K, V, S>,
@@ -1597,8 +1555,7 @@ impl<K, V, S> Debug for RawEntryBuilder<'_, K, V, S> {
15971555
///
15981556
/// This `enum` is constructed from the [`entry`] method on [`HashMap`].
15991557
///
1600-
/// [`HashMap`]: struct.HashMap.html
1601-
/// [`entry`]: struct.HashMap.html#method.entry
1558+
/// [`entry`]: HashMap::entry
16021559
#[stable(feature = "rust1", since = "1.0.0")]
16031560
pub enum Entry<'a, K: 'a, V: 'a> {
16041561
/// An occupied entry.
@@ -2156,7 +2113,7 @@ impl<'a, K, V> OccupiedEntry<'a, K, V> {
21562113
/// If you need a reference to the `OccupiedEntry` which may outlive the
21572114
/// destruction of the `Entry` value, see [`into_mut`].
21582115
///
2159-
/// [`into_mut`]: #method.into_mut
2116+
/// [`into_mut`]: Self::into_mut
21602117
///
21612118
/// # Examples
21622119
///
@@ -2189,7 +2146,7 @@ impl<'a, K, V> OccupiedEntry<'a, K, V> {
21892146
///
21902147
/// If you need multiple references to the `OccupiedEntry`, see [`get_mut`].
21912148
///
2192-
/// [`get_mut`]: #method.get_mut
2149+
/// [`get_mut`]: Self::get_mut
21932150
///
21942151
/// # Examples
21952152
///
@@ -2475,9 +2432,6 @@ where
24752432
/// [`Hasher`], but the hashers created by two different `RandomState`
24762433
/// instances are unlikely to produce the same result for the same values.
24772434
///
2478-
/// [`HashMap`]: struct.HashMap.html
2479-
/// [`Hasher`]: ../../hash/trait.Hasher.html
2480-
///
24812435
/// # Examples
24822436
///
24832437
/// ```
@@ -2547,9 +2501,6 @@ impl BuildHasher for RandomState {
25472501
///
25482502
/// The internal algorithm is not specified, and so it and its hashes should
25492503
/// not be relied upon over releases.
2550-
///
2551-
/// [`RandomState`]: struct.RandomState.html
2552-
/// [`Hasher`]: ../../hash/trait.Hasher.html
25532504
#[stable(feature = "hashmap_default_hasher", since = "1.13.0")]
25542505
#[allow(deprecated)]
25552506
#[derive(Clone, Debug)]

src/tools/linkchecker/main.rs

-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ fn check(cache: &mut Cache, root: &Path, file: &Path, errors: &mut bool) -> Opti
130130
|| file.ends_with("alloc/collections/btree_set/struct.BTreeSet.html")
131131
|| file.ends_with("std/collections/btree_map/struct.BTreeMap.html")
132132
|| file.ends_with("std/collections/btree_set/struct.BTreeSet.html")
133-
|| file.ends_with("std/collections/hash_map/struct.HashMap.html")
134133
|| file.ends_with("std/collections/hash_set/struct.HashSet.html")
135134
{
136135
return None;

0 commit comments

Comments
 (0)