Auto merge of #4322 - Y0hy0h:patch-1, r=phansch

Improve documentation on implicit_hasher lint

Provide an example of how to fix the implicit_hasher lint.

Fixes #3475.

changelog: none
This commit is contained in:
bors 2019-08-01 18:58:11 +00:00
commit d43ef7aa3f

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, BuildHasher};
/// # 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"