-
Notifications
You must be signed in to change notification settings - Fork 411
Convert file-level rustfmt skip to fn level skips #3809
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
Conversation
👋 Thanks for assigning @TheBlueMatt as a reviewer! |
9874e55
to
69a9581
Compare
a88062e
to
16025f2
Compare
As discussed in sync meet, I will try to extend the script to ignore rustfmt changes that only affect the function signature. |
16025f2
to
9ff8996
Compare
Pushed fix up commit to ignore sig changes. Modest reduction in skips, with a few edge cases. |
9ff8996
to
cf4e480
Compare
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:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this in draft? This needs a rebase by now, too.
fuzz/src/msg_targets/mod.rs
Outdated
@@ -1,48 +1,47 @@ | |||
#![cfg_attr(rustfmt, rustfmt_skip)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, didn't know it was auto-generated. Removed the commit that formats this file.
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
06eba3b
Compare
#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
a38db49
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM from what I've seen so far.
Mind including the same changes for the remaining files in chain
,ln
, and routing
, too?
Intentionally left these out because there are fmt prs in flight for those files. Links in pr desc |
Ah, right. The remaining ones in |
a38db49
to
f097207
Compare
Re-added |
f097207
to
1abfab8
Compare
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
8cecc34
Compare
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
2dda75d
Compare
Also 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
lightning/src/ln/chan_utils.rs
Outdated
monitor.provide_secret(281474976710655, secrets.last().unwrap().clone()).unwrap(); | ||
test_secrets!(); | ||
|
||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want to go ahead and break the hex constants out to give them names?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. All gave them the same hex
name though...
7d69403
to
516fdb3
Compare
516fdb3
to
6932d3e
Compare
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. |
Didn't squash the redundant skip removal commit, in case I need to re-run the script and re-apply the edge case fixes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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