Skip to content

Remove low-hanging fruit rustfmt::skips in ChannelManager pt. 2 #3850

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

valentinewallace
Copy link
Contributor

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 ~10 lines long.

Follows on from #3844, since that one landed so easily.

@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Jun 12, 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 12, 2025

Codecov Report

Attention: Patch coverage is 91.02990% with 27 lines in your changes missing coverage. Please review.

Project coverage is 89.93%. Comparing base (3333b6d) to head (a27c1cb).
Report is 13 commits behind head on main.

Files with missing lines Patch % Lines
lightning/src/ln/channelmanager.rs 91.02% 22 Missing and 5 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3850      +/-   ##
==========================================
- Coverage   89.94%   89.93%   -0.02%     
==========================================
  Files         163      163              
  Lines      131655   131826     +171     
  Branches   131655   131826     +171     
==========================================
+ Hits       118421   118556     +135     
- Misses      10550    10582      +32     
- Partials     2684     2688       +4     

☔ 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.

joostjager
joostjager previously approved these changes Jun 12, 2025
Copy link
Contributor

@joostjager joostjager left a comment

Choose a reason for hiding this comment

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

Checked the fmt fixes, LGTM. But still I think we have to be super careful with these "random" refactorings outside the context of a functional PR. Maybe it is okay to not touch it also...

best_block_height,
&self.logger,
&self.pending_events,
|args| self.send_payment_along_path(args),
Copy link
Contributor

Choose a reason for hiding this comment

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

Pretty vertical, but also fairly static code, and probably not so easy to refactor.

joostjager
joostjager previously approved these changes Jun 12, 2025
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.

This needs a rebase now.

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.
@valentinewallace
Copy link
Contributor Author

Rebased

Copy link
Contributor

@joostjager joostjager left a comment

Choose a reason for hiding this comment

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

I do feel the urge to again emphasize that we need to be so careful with "random" refactoring. Especially if we only save a couple of lines compared to naive rustfmt. It doesn't take much for something to slip through.

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