Skip to content

Commit d43ef7a

Browse files
committed
Auto merge of rust-lang#4322 - Y0hy0h:patch-1, r=phansch
Improve documentation on implicit_hasher lint Provide an example of how to fix the implicit_hasher lint. Fixes rust-lang#3475. changelog: none
2 parents 18a7dce + 5decadd commit d43ef7a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

clippy_lints/src/types.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -1923,12 +1923,21 @@ declare_clippy_lint! {
19231923
/// **Example:**
19241924
/// ```rust
19251925
/// # use std::collections::HashMap;
1926-
/// # use std::hash::Hash;
1926+
/// # use std::hash::{Hash, BuildHasher};
19271927
/// # trait Serialize {};
19281928
/// impl<K: Hash + Eq, V> Serialize for HashMap<K, V> { }
19291929
///
19301930
/// pub fn foo(map: &mut HashMap<i32, i32>) { }
19311931
/// ```
1932+
/// could be rewritten as
1933+
/// ```rust
1934+
/// # use std::collections::HashMap;
1935+
/// # use std::hash::{Hash, BuildHasher};
1936+
/// # trait Serialize {};
1937+
/// impl<K: Hash + Eq, V, S: BuildHasher> Serialize for HashMap<K, V, S> { }
1938+
///
1939+
/// pub fn foo<S: BuildHasher>(map: &mut HashMap<i32, i32, S>) { }
1940+
/// ```
19321941
pub IMPLICIT_HASHER,
19331942
style,
19341943
"missing generalization over different hashers"

0 commit comments

Comments
 (0)