diff options
| author | Scott McMurray <scottmcm@users.noreply.github.com> | 2021-06-24 01:30:08 -0700 |
|---|---|---|
| committer | Scott McMurray <scottmcm@users.noreply.github.com> | 2021-06-24 01:30:48 -0700 |
| commit | 579d19bc6ac91548e8b256656ca1d7fbceb53197 (patch) | |
| tree | 147699d6991f491a7e971777e13ee5505c43729c /library/core/src/array | |
| parent | 63d28192daf0ac2c704f4893d81ff32e1562e3c1 (diff) | |
| download | rust-579d19bc6ac91548e8b256656ca1d7fbceb53197.tar.gz rust-579d19bc6ac91548e8b256656ca1d7fbceb53197.zip | |
Use `hash_one` to simplify some other doctests
Diffstat (limited to 'library/core/src/array')
| -rw-r--r-- | library/core/src/array/mod.rs | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/library/core/src/array/mod.rs b/library/core/src/array/mod.rs index f44e22b3dbd..030b42a53d0 100644 --- a/library/core/src/array/mod.rs +++ b/library/core/src/array/mod.rs @@ -143,18 +143,13 @@ impl<'a, T, const N: usize> TryFrom<&'a mut [T]> for &'a mut [T; N] { /// as required by the `Borrow` implementation. /// /// ``` -/// use std::hash::{BuildHasher, Hash, Hasher}; -/// -/// fn hash_of(x: impl Hash, b: &impl BuildHasher) -> u64 { -/// let mut h = b.build_hasher(); -/// x.hash(&mut h); -/// h.finish() -/// } +/// #![feature(build_hasher_simple_hash_one)] +/// use std::hash::BuildHasher; /// /// let b = std::collections::hash_map::RandomState::new(); /// let a: [u8; 3] = [0xa8, 0x3c, 0x09]; /// let s: &[u8] = &[0xa8, 0x3c, 0x09]; -/// assert_eq!(hash_of(a, &b), hash_of(s, &b)); +/// assert_eq!(b.hash_one(a), b.hash_one(s)); /// ``` #[stable(feature = "rust1", since = "1.0.0")] impl<T: Hash, const N: usize> Hash for [T; N] { |
