Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

fix compilation warnings #11522

Merged
merged 1 commit into from
Feb 26, 2020
Merged

fix compilation warnings #11522

merged 1 commit into from
Feb 26, 2020

Conversation

ordian
Copy link
Collaborator

@ordian ordian commented Feb 26, 2020

No description provided.

@ordian ordian added the A2-insubstantial 👶 Pull request requires no code review (e.g., a sub-repository hash update). label Feb 26, 2020
@@ -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> {
Copy link
Collaborator

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?

Copy link
Collaborator Author

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> {
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^         ^^^^^^^^^^^^^^^^

🤷‍♂️

Copy link
Collaborator

@niklasad1 niklasad1 Feb 26, 2020

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

@ordian ordian merged commit ec8dbb3 into master Feb 26, 2020
@ordian ordian deleted the ao-fix-warnings branch February 26, 2020 11:58
ordian added a commit that referenced this pull request Feb 26, 2020
* master:
  fix compilation warnings (#11522)
ordian added a commit that referenced this pull request Mar 6, 2020
* 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)
  ...
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A2-insubstantial 👶 Pull request requires no code review (e.g., a sub-repository hash update).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants