-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Conversation
@@ -66,15 +62,15 @@ impl<T> Len for LinkedList<T> { | |||
fn len(&self) -> usize { LinkedList::len(self) } | |||
} | |||
|
|||
impl<K: Eq + Hash, V> Len for HashMap<K, V> { | |||
impl<K: Eq + Hash, V, S: std::hash::BuildHasher> Len for HashMap<K, V, S> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: does this make it more generic instead of using https://doc.rust-lang.org/std/collections/hash_map/struct.RandomState.html?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's what the compiler told me to do
warning: impl for `HashMap` should be generalized over different hashers
--> util/len-caching-lock/src/lib.rs:69:31
|
69 | impl<K: Eq + Hash, V> Len for HashMap<K, V> {
| ^^^^^^^^^^^^^
|
= note: `#[warn(clippy::implicit_hasher)]` on by default
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#implicit_hasher
help: consider adding a type parameter
|
69 | impl<K: Eq + Hash, V, S: ::std::hash::BuildHasher> Len for HashMap<K, V, S> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
🤷♂️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, yeah I think what I wrote is correct because https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#202, uses a default type parameter. Then you can't use your custom Hasher.
Clippy lint: https://rust-lang.github.io/rust-clippy/master/#implicit_hasher
* master: fix compilation warnings (#11522)
* master: (27 commits) Faster kill_garbage (#11514) [EngineSigner]: don't sign message with only zeroes (#11524) fix compilation warnings (#11522) [ethcore cleanup]: various unrelated fixes from `#11493` (#11507) Add benchmark for transaction execution (#11509) Add Smart Contract License v1.0 Misc fixes (#11510) [dependencies]: unify `rustc-hex` (#11506) Activate on-chain randomness in POA Sokol (#11505) Grab bag of cleanup (#11504) Implement eth/64 (EIP-2364) and drop support for eth/62 (#11472) [dependencies]: remove `util/macros` (#11501) OpenEthereum bootnodes are added (#11499) [ci benches]: use `all-features` (#11496) [verification]: make test-build compile standalone (#11495) complete null-signatures removal (#11491) Include the seal when populating the header for a new block (#11475) fix compilation warnings (#11492) cargo update -p cmake (#11490) update to published rlp-derive (#11489) ...
No description provided.