-
Notifications
You must be signed in to change notification settings - Fork 9
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
Enable pedantic lints #159
Conversation
590f945
to
4697da8
Compare
Checked that the |
FTR I didn't know about |
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.
ACK 4697da8; successfully ran local tests
Bump, this guy too please. |
Needs rebase now. |
Copy the current nightly version from `rust-bitcoin`.
Configure `clippy` to do warn for pedantic lints and fix warnings.
4697da8
to
a05406c
Compare
Rebased and squashed. No other changes. |
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.
ACK a05406c; successfully ran local tests
@@ -51,7 +51,7 @@ impl<const CAP: usize> BufEncoder<CAP> { | |||
#[inline] | |||
#[allow(clippy::let_unit_value)] // Allow the unit value of the const check | |||
pub fn new(case: Case) -> Self { | |||
let _ = Self::_CHECK_EVEN_CAPACITY; | |||
let () = Self::_CHECK_EVEN_CAPACITY; |
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 forgot to remove the allow
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.
Fixed, thanks.
OddLengthString(ref e) => | ||
E::InvalidChar(ref e) => | ||
write_err!(f, "invalid char, failed to create bytes from hex"; e), | ||
E::OddLengthString(ref e) => |
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.
IMO the problems the original way causes are too unlikely to bother but I'm also not going to change it back.
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.
I also don't like the original way stylistically. It's hard to tell where the symbols are coming from because of the wildcard import.
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, though note that for me this, as opposed to other wildcard cases, is an easily-recognizable pattern. The match
is matching on what's clearly an enum, based on its structure and if the variants don't have the X::
prefix then it's clear it must be wildcard imported in the statement above match. Of course one could uselessly import a different enum but that would cause other warnings. It does require a bit of discipline - to only put the use
in the same function. But I have no problem with such discipline.
Anyway, not a big deal.
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.
As everyone knows I'm a sucker for uniformity. Sometimes the variant names clash and then the wildcard cannot be used which means breaking uniformity. The new style is always valid and stomps the lint warning - seems like a win. It is admittedly a bit ugly.
This attribute was mistakenly left in during dev/review cycle in rust-bitcoin#159, it serves no purpose.
Configure
clippy
to warn for pedantic lints. Leave themissing_errors_doc
one for a soon-to-come docs PR.