3939//! If you need more control over how a value is hashed, you need to implement
4040//! the [`Hash`] trait:
4141//!
42- //! [`Hash`]: trait.Hash.html
43- //!
4442//! ```rust
4543//! use std::collections::hash_map::DefaultHasher;
4644//! use std::hash::{Hash, Hasher};
@@ -149,11 +147,9 @@ mod sip;
149147/// Thankfully, you won't need to worry about upholding this property when
150148/// deriving both [`Eq`] and `Hash` with `#[derive(PartialEq, Eq, Hash)]`.
151149///
152- /// [`Eq`]: ../../std/cmp/trait.Eq.html
153- /// [`Hasher`]: trait.Hasher.html
154150/// [`HashMap`]: ../../std/collections/struct.HashMap.html
155151/// [`HashSet`]: ../../std/collections/struct.HashSet.html
156- /// [`hash`]: #tymethod. hash
152+ /// [`hash`]: Hash:: hash
157153#[ stable( feature = "rust1" , since = "1.0.0" ) ]
158154pub trait Hash {
159155 /// Feeds this value into the given [`Hasher`].
@@ -168,8 +164,6 @@ pub trait Hash {
168164 /// 7920.hash(&mut hasher);
169165 /// println!("Hash is {:x}!", hasher.finish());
170166 /// ```
171- ///
172- /// [`Hasher`]: trait.Hasher.html
173167 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
174168 fn hash < H : Hasher > ( & self , state : & mut H ) ;
175169
@@ -186,8 +180,6 @@ pub trait Hash {
186180 /// Hash::hash_slice(&numbers, &mut hasher);
187181 /// println!("Hash is {:x}!", hasher.finish());
188182 /// ```
189- ///
190- /// [`Hasher`]: trait.Hasher.html
191183 #[ stable( feature = "hash_slice" , since = "1.3.0" ) ]
192184 fn hash_slice < H : Hasher > ( data : & [ Self ] , state : & mut H )
193185 where
@@ -239,10 +231,9 @@ pub use macros::Hash;
239231/// println!("Hash is {:x}!", hasher.finish());
240232/// ```
241233///
242- /// [`Hash`]: trait.Hash.html
243- /// [`finish`]: #tymethod.finish
244- /// [`write`]: #tymethod.write
245- /// [`write_u8`]: #method.write_u8
234+ /// [`finish`]: Hasher::finish
235+ /// [`write`]: Hasher::write
236+ /// [`write_u8`]: Hasher::write_u8
246237#[ stable( feature = "rust1" , since = "1.0.0" ) ]
247238pub trait Hasher {
248239 /// Returns the hash value for the values written so far.
@@ -264,7 +255,7 @@ pub trait Hasher {
264255 /// println!("Hash is {:x}!", hasher.finish());
265256 /// ```
266257 ///
267- /// [`write`]: #tymethod. write
258+ /// [`write`]: Hasher:: write
268259 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
269260 fn finish ( & self ) -> u64 ;
270261
@@ -433,8 +424,7 @@ impl<H: Hasher + ?Sized> Hasher for &mut H {
433424/// assert_eq!(hasher_1.finish(), hasher_2.finish());
434425/// ```
435426///
436- /// [`build_hasher`]: #tymethod.build_hasher
437- /// [`Hasher`]: trait.Hasher.html
427+ /// [`build_hasher`]: BuildHasher::build_hasher
438428/// [`HashMap`]: ../../std/collections/struct.HashMap.html
439429#[ stable( since = "1.7.0" , feature = "build_hasher" ) ]
440430pub trait BuildHasher {
@@ -456,8 +446,6 @@ pub trait BuildHasher {
456446 /// let s = RandomState::new();
457447 /// let new_s = s.build_hasher();
458448 /// ```
459- ///
460- /// [`Hasher`]: trait.Hasher.html
461449 #[ stable( since = "1.7.0" , feature = "build_hasher" ) ]
462450 fn build_hasher ( & self ) -> Self :: Hasher ;
463451}
@@ -470,7 +458,7 @@ pub trait BuildHasher {
470458/// defined.
471459///
472460/// Any `BuildHasherDefault` is [zero-sized]. It can be created with
473- /// [`default`][method.Default ]. When using `BuildHasherDefault` with [`HashMap`] or
461+ /// [`default`][method.default ]. When using `BuildHasherDefault` with [`HashMap`] or
474462/// [`HashSet`], this doesn't need to be done, since they implement appropriate
475463/// [`Default`] instances themselves.
476464///
@@ -503,10 +491,7 @@ pub trait BuildHasher {
503491/// let hash_map = HashMap::<u32, u32, MyBuildHasher>::default();
504492/// ```
505493///
506- /// [`BuildHasher`]: trait.BuildHasher.html
507- /// [`Default`]: ../default/trait.Default.html
508- /// [method.default]: #method.default
509- /// [`Hasher`]: trait.Hasher.html
494+ /// [method.default]: BuildHasherDefault::default
510495/// [`HashMap`]: ../../std/collections/struct.HashMap.html
511496/// [`HashSet`]: ../../std/collections/struct.HashSet.html
512497/// [zero-sized]: https://doc.rust-lang.org/nomicon/exotic-sizes.html#zero-sized-types-zsts
0 commit comments