-
Notifications
You must be signed in to change notification settings - Fork 427
Fix nightly Clippy warnings #338
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
src/psbt/mod.rs
Outdated
| Some(in_tx.output[tx.input[input_index].previous_output.vout as usize].clone()) | ||
| } else { | ||
| None | ||
| match self.inputs.get(input_index) { |
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 do agree this code looks less readable than before, if the specific lint is not usable maybe #[allow(clippy::all)] with a comment for this block?
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.
Cool, nice idea, I did not think of that. Will update PR as suggested. Thanks.
It is redundant to pass true/false to `assert_eq!` since `assert!`
already asserts true/false.
This may, however, be controversial if someone thinks that
```
assert_eq!(foo, false);
```
is more clear than
```
assert!(!foo);
```
Use `assert!` directly instead of `assert_eq!` with true/false argument.
Clippy emits: warning: using `clone` on type `descriptor::policy::Condition` which implements the `Copy` trait Remove the clone and rely on `Copy`.
Clippy emits: warning: called `is_none()` after searching an `Iterator` with `find` As suggested, use the construct: `!foo.iter().any(...)`
Clippy emits: warning: struct constructor field order is inconsistent with struct definition field order As suggested, re-order the fields to be consistent with the struct definition.
The lint `manual_map` is new so we cannot explicitly allow it and maintain backwards comparability. Instead, allow all lints for `get_utxo_for` with a comment explaining why.
Clippy emits: warning: unneeded unit expression As suggested, remove the unneeded unit expression.
|
Please note, this PR now has an additional commit on the end of it (a new nightly Clippy warning snuck in during rebase on master). |
notmandatory
left a comment
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.
Look like good cleanups and as usual good commit docs. ACK e1066e9
Thanks, appreciate the complement. My commit log habits were formed in the fires of the linux-staging mailing list :) |
Description
Checking
bdkwith the nightly toolchain throws a bunch of warnings,all are trivial to fix. Turns out one of them is not, the final patch of this PR may or may not be deemed an improvement, please review and I can drop if required.Fix warnings emitted by Clippy when using nightly toolchain.
Notes to the reviewers
While bdk does not appear to explicitly rely on nightly features I like to use nightly so I can pass
-Zunstable-optionsto clippy. I do this so that Clippy doesn't hide warnings after the first time showing them, instead throwing warnings every check.Checklists
All Submissions:
cargo fmtandcargo clippybefore committing