Uh oh!
There was an error while loading. Please reload this page.
Convert file-level rustfmt skip to fn level skips - #3809
Conversation
👋 Thanks for assigning @TheBlueMatt as a reviewer! |
a88062e to
16025f2Comparejoostjager
commented
May 29, 2025
As discussed in sync meet, I will try to extend the script to ignore rustfmt changes that only affect the function signature. |
joostjager
commented
May 30, 2025
Pushed fix up commit to ignore sig changes. Modest reduction in skips, with a few edge cases. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@## main #3809 +/- ##
==========================================
+ Coverage 89.87% 89.91% +0.03%
==========================================
Files 162 162 Lines 130214 130684 +470 Branches 130214 130684 +470 ==========================================
+ Hits 117034 117508 +474 + Misses 10486 10484 -2 + Partials 2694 2692 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
tnull
left a comment
There was a problem hiding this comment.
Why is this in draft? This needs a rebase by now, too.
| @@ -1,48 +1,47 @@ | |||
| #![cfg_attr(rustfmt, rustfmt_skip)] | |||
There was a problem hiding this comment.
This was put here deliberately as we opted against running rustfmt on autogenerated files. We need to fix it either way, likely just revert it to include the skip.
There was a problem hiding this comment.
Ah, didn't know it was auto-generated. Removed the commit that formats this file.
joostjager
commented
Jun 3, 2025
It's in draft because I want to see #3767 merged first. Don't want to spend time on rebase if we don't go this way. |
cf4e480 to
06eba3bComparejoostjager
commented
Jun 11, 2025
#3767 seems a positive change. New code being added in PRs (for example async payments) is now automatically formatted and not creating more formatting debt. No bad rebase conflicts that I've heard of either. Enough to go ahead and re-run the script on the latest main. |
06eba3b to
a38db49Compare
tnull
left a comment
There was a problem hiding this comment.
LGTM from what I've seen so far.
Mind including the same changes for the remaining files in chain,ln, and routing, too?
joostjager
commented
Jun 11, 2025
Intentionally left these out because there are fmt prs in flight for those files. Links in pr desc |
tnull
commented
Jun 11, 2025
Ah, right. The remaining ones in |
a38db49 to
f097207Comparejoostjager
commented
Jun 11, 2025
Re-added |
f097207 to
1abfab8CompareTheBlueMatt
commented
Jun 11, 2025
I admit I'm kinda meh oh doing this for everything. There's a handful of files left that are pretty small and can be easily formatted (at least once trampoline PRs land for For large files that we want to format iteratively (channelmanager, channel, maybe some of |
1abfab8 to
8cecc34Comparejoostjager
commented
Jun 12, 2025
I see what you mean. Applying skips now and removing them "soon" feels unnecessary. The way I see it though is that "soon" may be quite a bit further out than we'd like. Trampoline for example may take a while. Adding the skips doesn't hurt, they can easily be removed again if someone feels inclined to format a full file, and they add flexibility for devs to selectively format for whatever reason.
I needed to rebase this PR anyway, and while I did I left out the test files. If you feel it is still too much, maybe you can list the exact files that are definitely good for the incremental approach? |
8cecc34 to
2dda75dCompareAlso not sure at all that doing the tests all in one with mass edits is ideal: #3783 (review) |
There was a problem hiding this comment.
I think the file list here makes sense. I thought there were substantially more changes to onion_payment.rs for trampoline to come but @valentinewallace tells me they're more in outbound_payment.rs which has more active development and thus higher cost to delaying pushing the format skips down in it.
| secrets.push([0; 32]); | ||
| secrets.last_mut().unwrap()[0..32].clone_from_slice(&<Vec<u8>>::from_hex("c7518c8ae4660ed02894df8976fa1a3659c1a8b4b5bec0c4b872abeba4cb8964").unwrap()); | ||
| secrets.last_mut().unwrap()[0..32].clone_from_slice( | ||
| &<Vec<u8>>::from_hex( |
There was a problem hiding this comment.
Do you want to go ahead and break the hex constants out to give them names?
There was a problem hiding this comment.
Done. All gave them the same hex name though...
7d69403 to
516fdb3Compare516fdb3 to
6932d3eCompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
joostjager
commented
Jun 12, 2025
Removed redundant skips. Didn't do the optional improvements (format short fns), because it is probably easiest to keep this big PR "pure" and do the rest in follow ups. |
joostjager
commented
Jun 12, 2025
Didn't squash the redundant skip removal commit, in case I need to re-run the script and re-apply the edge case fixes. |
TheBlueMatt
left a comment
There was a problem hiding this comment.
11 files changed, 1984 insertions(+), 668 deletions(-)
Holy diff-size batman!
Extend the approach proposed in #3767 to the full repository. The change set is automatically generated using a script. The script omits skip directives when they would not impact formatting (code already rustfmt-compliant).
I've fixed various problems with the script, and it may be that there are a few edge cases left that should have had a skip directive. There could also be a few redundant ones. I think we can live with that.
Omitted are files that are formatted in in-flight rustfmt PRs: #3783, #3725
, #3338 and #3337