Fix nightly Clippy warnings#338
Merged
notmandatory merged 6 commits intobitcoindevkit:masterfrom May 18, 2021
Merged
Conversation
RCasatta
reviewed
May 7, 2021
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) { |
Member
There was a problem hiding this comment.
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?
Contributor
Author
There was a problem hiding this comment.
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.
Contributor
Author
|
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
approved these changes
May 13, 2021
Member
notmandatory
left a comment
There was a problem hiding this comment.
Look like good cleanups and as usual good commit docs. ACK e1066e9
Contributor
Author
Thanks, appreciate the complement. My commit log habits were formed in the fires of the linux-staging mailing list :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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