Skip to content

Commit d7224a6

Browse files
author
Y0hy0h
authored
Improve documentation on implicit_hasher lint
Provide an example of how to fix the lint.
1 parent 5d061d7 commit d7224a6

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;
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)