-
Notifications
You must be signed in to change notification settings - Fork 831
Fixed a bunch of clippy lints, added clippy.toml #686
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
Conversation
e70297b
to
fea88ae
Compare
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 fea88aea33a9ac2d03a77cf08eade0ebdad2da01
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.
Nice one, thanks.
Of possible relevance to this work is: #688 (further configures clippy). |
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.
Nice changes, including some that should help prevent the introduction of bugs later on.
ACK
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.
LGTM mod two nits
/// Error returned when parsing `SigHashType` fails. | ||
/// | ||
/// This is currently returned for unrecognized sighash strings. | ||
#[derive(Debug, Clone)] |
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.
#[derive(ParialEq, Eq, PartialOrd, Ord)]
, according to our new contributing guidelines :)
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.
TBH, I'm not really convinced errors should commit to Ord
/PartialOrd
. Maybe Eq
is fine.
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.
What about Hash
?
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.
If there's Eq
there should be Hash
, I believe.
In this specific case I'm not even sure about Eq
. Are two errors carrying information saying "can't recognize sighash string" (by their existence) that were caused by different input (which they write for ease of debugging) equal or not?
/// Error returned when a command string is invalid. | ||
/// | ||
/// This is currently returned for command strings longer than 12. | ||
#[derive(Clone, Debug)] |
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.
Ibid
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.
Here I still think #[derive(PartialEq, Eq)]
will be nice to have
@Kixunil needs rebase :( |
693f666
Rebased |
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 693f6666da64bf3140d50ca9983f3968c4c69802 with one small nit
/// Error returned when a command string is invalid. | ||
/// | ||
/// This is currently returned for command strings longer than 12. | ||
#[derive(Clone, Debug)] |
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.
Here I still think #[derive(PartialEq, Eq)]
will be nice to have
Will wait a bit if others have an opinion on this. Basically the question is "Do we want to commit to always carry error information that can be meaningfully compared?" |
If I remember correctly @apoelstra doesn't like struct initialization shorthand |
Shame, I do like it but willing to |
Adding allows everywhere will be messy as hell, structs get initialized all over the place. Probably best to let @apoelstra comment before starting a fight in his name though :) |
@tcharding I think they could be allowed globally in |
yeah, I realised this last night when I was going to sleep :) |
Sorry for being absent. I don't like the compact struct initialization format but I won't hold things up about it. I'm used to it by now :). Regarding errors satisfying Needs rebase. |
This is the initial step towards using and maybe enforcing clippy. It does not fix all lints as some are not applicable. They may be explicitly ignored later.
Rebased |
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 779d411
The only thing that raised my eyebrows was the initialization thing, but I'll choose some other hill to die on.
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 779d411
This is the initial step towards using and maybe enforcing clippy.
It does not fix all lints as some are not applicable. They may be
explicitly ignored later.
Some discussion about clippy was in #685