Improve documentation on implicit_hasher lint

Provide an example of how to fix the lint.
This commit is contained in:
Y0hy0h 2019-08-01 10:51:39 +02:00 committed by GitHub
parent 5d061d7058
commit d7224a6341
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1923,12 +1923,21 @@ declare_clippy_lint! {
/// **Example:**
/// ```rust
/// # use std::collections::HashMap;
/// # use std::hash::Hash;
/// # use std::hash::{Hash, BuildHasher};
/// # trait Serialize {};
/// impl<K: Hash + Eq, V> Serialize for HashMap<K, V> { }
///
/// pub fn foo(map: &mut HashMap<i32, i32>) { }
/// ```
/// could be rewritten as
/// ```rust
/// # use std::collections::HashMap;
/// # use std::hash::Hash;
/// # trait Serialize {};
/// impl<K: Hash + Eq, V, S: BuildHasher> Serialize for HashMap<K, V, S> { }
///
/// pub fn foo<S: BuildHasher>(map: &mut HashMap<i32, i32, S>) { }
/// ```
pub IMPLICIT_HASHER,
style,
"missing generalization over different hashers"