New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve hashes
trait method usage
#2714
base: master
Are you sure you want to change the base?
Improve hashes
trait method usage
#2714
Conversation
Currently we use the `Hash` trait in a bunch of places to call `all_zeros`. We are attempting to improve the `hashes` API and this usage is both unnecessary and also hindering that effort. Use the concrete type (e.g. `BlockHash`) instead of calling through the trait method. Refactor only, no logic changes.
Pull Request Test Coverage Report for Build 8855222593Details
💛 - Coveralls |
2a2b57f
to
a3a7389
Compare
@@ -308,7 +308,7 @@ mod test { | |||
|
|||
use hex::{test_hex_unwrap as hex, FromHex}; | |||
|
|||
use super::{AddrV2, AddrV2Message, Address}; | |||
use super::*; |
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.
In 9c47158:
There are still more explicit imports you need to drop if you add super::*
.
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.
Bother, thanks - I'll re-look.
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.
You might need to compile with nightly, and possibly nightly from a week ago, because I believe they just reverted a bunch of the "redundant import" lints due to mass protests.
Clean up the test imports in the `p2p` module: - Use `use super::*` as is conventional. - Use `sha256d::Hash` as is conventional. Refactor, no logic changes.
a3a7389
to
621ff28
Compare
Force push is the PR done properly this time:
|
Bringing traits into scope risks naming conflicts for no real reason because we can import traits using `as _`. Also, in `hashes` we always use `as _` so `bitcoin` and `hashes` are currently non-uniform. Use as-underscore when importing the `Hash` and `HashEngine` traits. Refactor, no logic changes.
621ff28
to
9e924cf
Compare
Done as part of the ongoing work to improve the
hashes
API.all_zeros
instead of the trait method.p2p
unit test imports (preparation for next patch)as _
when importingHash
andHashEngine
This whole PR is refactor only, no logic changes.