mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 21:23:56 +00:00
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:
commit
d43ef7aa3f
1 changed files with 10 additions and 1 deletions
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue