-
Notifications
You must be signed in to change notification settings - Fork 403
Rustfmt Maximalism #3749
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
base: main
Are you sure you want to change the base?
Rustfmt Maximalism #3749
Conversation
👋 Thanks for assigning @jkczyz as a reviewer! |
7be120f
to
ad093d8
Compare
ad093d8
to
3d52da9
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.
Confirmed I get the same output by running cargo fmt
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.
ACK if you review any follow-ups to fix things up after this :)
'a, | ||
'b, | ||
'c, | ||
'd, | ||
'e, | ||
'f, | ||
'logger, | ||
'h, | ||
'i, | ||
'j, | ||
'graph, | ||
'k, | ||
'mr, | ||
SD, | ||
M, | ||
T, | ||
F, | ||
C, | ||
L, |
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.
sheesh
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.
we're so back
flags & FundedStateFlags::ALL | ||
== FundedStateFlags::LOCAL_SHUTDOWN_SENT |
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 fits on one line. Is there something about our config that would cause it to split it over two lines?
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.
The reason is that rustfmt wants to put the ==
on the same line, pushing the total == FundedStateFlags::LOCAL_SHUTDOWN_SENT | FundedStateFlags::REMOTE_SHUTDOWN_SENT
to column 101. So expected behavior afaik.
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, it's bitwise not logical OR.
🔔 1st Reminder Hey @TheBlueMatt @jkczyz @wpaulino! This PR has been waiting for your review. |
2 similar comments
🔔 1st Reminder Hey @TheBlueMatt @jkczyz @wpaulino! This PR has been waiting for your review. |
🔔 1st Reminder Hey @TheBlueMatt @jkczyz @wpaulino! This PR has been waiting for your 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.
ACK, matches local cargo fmt
for file in $(comm -23 "$TMP_FILE" rustfmt_excluded_files); do | ||
echo "Checking formatting of $file" | ||
rustfmt $VERS --edition 2021 --check "$file" | ||
done |
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.
CONTRIBUTING.md
needs update to remove reference to contrib/run-rustfmt.sh
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.
Good one, will fix after rebase
🔔 2nd Reminder Hey @TheBlueMatt @jkczyz @wpaulino! This PR has been waiting for your review. |
1 similar comment
🔔 2nd Reminder Hey @TheBlueMatt @jkczyz @wpaulino! This PR has been waiting for your 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'm actually leaning toward this PR's approach and biting the bullet. I don't believe it's that cumbersome to existing PRs with your suggested solution.
Running cargo +1.63 fmt
(MSRV-shipped rustfmt), I get the same output.
To be sure we wouldn't get any problems with in-flight prs, I tried the filter-branch command from the PR description on #3751: joostjager/rust-lightning@main-fmt...joostjager:rust-lightning:rustfmt-tests-rewritten |
Another option that could be used is |
After rebasing my own rustfmt stuff I realized that the main rebase logic won't actually work in some cases around indentation changes. Because git sometimes mis-identifies hunks as non-conflict it'll end up duplicating some lines. |
I didn't run into this yet, but had identified the potential problem too. Updated the PR description with a new approach that strictly avoids any type of merge logic / automatic conflict resolution. |
🔔 3rd Reminder Hey @TheBlueMatt @jkczyz @wpaulino! This PR has been waiting for your review. |
🔔 3rd Reminder Hey @TheBlueMatt @jkczyz @wpaulino! This PR has been waiting for your review. |
🔔 4th Reminder Hey @TheBlueMatt @jkczyz @wpaulino! This PR has been waiting for your review. |
1 similar comment
🔔 4th Reminder Hey @TheBlueMatt @jkczyz @wpaulino! This PR has been waiting for your review. |
🔔 5th Reminder Hey @TheBlueMatt @jkczyz @wpaulino! This PR has been waiting for your review. |
1 similar comment
🔔 5th Reminder Hey @TheBlueMatt @jkczyz @wpaulino! This PR has been waiting for your review. |
Just enable it globally. We can take care of format refactors later or as we update the code, and this way we immediately eliminate the ongoing formatting micro-penalties.
To auto-format in-flight PRs without manual conflict resolution:
Let's say commit X is the commit where all of main is rustfmt'ed. Nothing other dan
cargo fmt
should have been done in this commit.