Skip to content

Run clippy fix #2049

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

Merged
merged 1 commit into from
Mar 6, 2023
Merged

Run clippy fix #2049

merged 1 commit into from
Mar 6, 2023

Conversation

douglaz
Copy link
Contributor

@douglaz douglaz commented Feb 24, 2023

Result of running:

cargo clippy --fix -F futures -- -Aclippy::erasing_op -Aclippy::never_loop -Aclippy::if_same_then_else -Dclippy::try_err -Aclippy::iter_kv_map

Plus some manual formatting fixes.

In my experience clippy --fix always improves the code so I always run it before any pull request. The only issue is when it tries to introduce new features beyond the MSRV.

I hope the changes are within the directives given in #724 (comment)

@codecov-commenter
Copy link

codecov-commenter commented Feb 24, 2023

Codecov Report

Patch coverage: 96.77% and project coverage change: +0.07 🎉

Comparison is base (b5e5435) 87.25% compared to head (05c9a0c) 87.32%.

❗ Current head 05c9a0c differs from pull request most recent head 6c348de. Consider uploading reports for the commit 6c348de to get more accurate results

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2049      +/-   ##
==========================================
+ Coverage   87.25%   87.32%   +0.07%     
==========================================
  Files         100      101       +1     
  Lines       44480    44350     -130     
  Branches    44480    44350     -130     
==========================================
- Hits        38810    38728      -82     
+ Misses       5670     5622      -48     
Impacted Files Coverage Δ
lightning-block-sync/src/poll.rs 82.35% <ø> (+0.95%) ⬆️
lightning-invoice/src/payment.rs 76.53% <50.00%> (+0.77%) ⬆️
lightning-background-processor/src/lib.rs 81.31% <80.00%> (-0.58%) ⬇️
lightning-block-sync/src/init.rs 87.79% <100.00%> (ø)
lightning-block-sync/src/lib.rs 87.31% <100.00%> (ø)
lightning-block-sync/src/test_utils.rs 79.19% <100.00%> (+0.28%) ⬆️
lightning-invoice/src/de.rs 85.00% <100.00%> (+0.28%) ⬆️
lightning-invoice/src/lib.rs 70.67% <100.00%> (+0.48%) ⬆️
lightning-invoice/src/ser.rs 80.34% <100.00%> (ø)
lightning-invoice/src/utils.rs 96.14% <100.00%> (ø)
... and 34 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@dunxen
Copy link
Contributor

dunxen commented Feb 26, 2023

Thanks! Concept ACK.
Will give full review in the morning. :)

@dunxen dunxen self-requested a review February 26, 2023 19:59
dunxen
dunxen previously approved these changes Feb 27, 2023
Copy link
Contributor

@dunxen dunxen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. These are all fair improvements. A big plus for it catching some unnecessary clones.

@dunxen
Copy link
Contributor

dunxen commented Feb 27, 2023

I think if we're only looking at a small set of ignores then it seems palatable to automate clippy checks with the MSRV in GH actions. I am for doing that.

Copy link
Contributor

@tnull tnull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks good, some nits/comments.

@@ -1316,7 +1316,7 @@ mod tests {
// this should have added two channels
assert_eq!(network_graph.read_only().channels().len(), 3);

let _ = receiver
receiver
.recv_timeout(Duration::from_secs(super::FIRST_NETWORK_PRUNE_TIMER * 5))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Can now move the next line up.

Copy link
Contributor Author

@douglaz douglaz Feb 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is still consistent with the style of the test, will leave it as is

@douglaz
Copy link
Contributor Author

douglaz commented Feb 27, 2023

Added -Dclippy::separated_literal_suffix plus minor formatting change. Also run against current main.

@douglaz
Copy link
Contributor Author

douglaz commented Feb 27, 2023

Fixed conflict because of new commit

Copy link
Collaborator

@TheBlueMatt TheBlueMatt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Basically LGTM.

Copy link
Contributor

@tnull tnull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, feel free to squash commits from my side.

@TheBlueMatt
Copy link
Collaborator

Total diff LGTM, thanks! Can you squash down the commits so that later commits aren't tweaking things done in the previous commits? Then I think we can land.

@douglaz
Copy link
Contributor Author

douglaz commented Mar 6, 2023

Squashed into one commit without further changes

@TheBlueMatt TheBlueMatt merged commit ccac926 into lightningdevkit:main Mar 6, 2023
@douglaz douglaz deleted the run-clippy-fix branch March 6, 2023 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants