Skip to content

Remove low-hanging fruit rustfmt::skips in ChannelManager #3844

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 3 commits into from
Jun 11, 2025

Conversation

valentinewallace
Copy link
Contributor

@valentinewallace valentinewallace commented Jun 10, 2025

After #3767 landed, there were a bunch of rustfmt::skips added to ChannelManager that could easily be removed.

Here we pick some of that low-hanging fruit by removing the skips for methods that are less than ~5 lines long.

We also remove skips from all cfg(async_payments) code since as the feature owner I know that's safe from unwanted rebase conflicts.

@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Jun 10, 2025

👋 Thanks for assigning @joostjager as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

Copy link

codecov bot commented Jun 10, 2025

Codecov Report

Attention: Patch coverage is 78.04154% with 74 lines in your changes missing coverage. Please review.

Project coverage is 89.83%. Comparing base (e797180) to head (1532913).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
lightning/src/ln/channelmanager.rs 78.04% 66 Missing and 8 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3844      +/-   ##
==========================================
- Coverage   89.87%   89.83%   -0.05%     
==========================================
  Files         162      162              
  Lines      130214   130415     +201     
  Branches   130214   130415     +201     
==========================================
+ Hits       117034   117159     +125     
- Misses      10486    10553      +67     
- Partials     2694     2703       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

rustfmt::skips were added recently all over channelmanager in order for
formatting to be enforced for all new code added to the file.

Here we remove a bunch of those skips that aren't necessary because the
methods that are skipped are so short.

Does not include cfg(splicing) code.

Here we just remove the rustfmt skips, in the next commit we'll clean up the
code that rustfmt made too vertical.
In the previous commit we formatted a bunch of short methods. Here we clean up
the default formatting that rustfmt applied by extracting code into variables.
This code is not at risk of unwanted rebase conflicts, so the skips can safely
be removed. Also did one minor extraction into a variable.
@valentinewallace valentinewallace force-pushed the 2025-06-fmt-chanmgr-more branch from f752e7f to 1532913 Compare June 10, 2025 22:25
funding_transaction,
)
let temporary_chan = &[(&temporary_channel_id, &counterparty_node_id)];
self.batch_funding_transaction_generated(temporary_chan, funding_transaction)
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this change is necessary, but no objection either.

@@ -713,6 +713,10 @@ impl_writeable_tlv_based_enum!(SentHTLCId,
},
);

// (src_channel_id, src_counterparty_node_id, src_funding_outpoint, src_chan_id, src_user_chan_id)
type PerSourcePendingForward =
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this just be a struct now? Pre-existing though.

self.abandon_payment_with_reason(payment_id, PaymentFailureReason::BlindedPathCreationFailed);
res = Err(Bolt12PaymentError::BlindedPathCreationFailed);
return NotifyOption::DoPersist
let enqueue_held_htlc_available_res = self.flow.enqueue_held_htlc_available(
Copy link
Contributor

Choose a reason for hiding this comment

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

Could be risk-reducing to keep every change that isn't strictly rustfmt in a separate commit.

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.

Going ahead landing this.

@tnull tnull merged commit b8673f3 into lightningdevkit:main Jun 11, 2025
27 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants