Skip to content

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

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

Conversation

joostjager
Copy link
Contributor

@joostjager joostjager commented Apr 25, 2025

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:

git filter-branch --tree-filter 'cargo fmt' -f main..HEAD

After rewriting the branch, rebase onto a fully formatted main branch. For any conflicts, just choose 'theirs' (git rebase -X theirs main)

@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Apr 25, 2025

👋 Thanks for assigning @jkczyz 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.

@joostjager joostjager marked this pull request as ready for review April 25, 2025 13:15
@joostjager joostjager removed the request for review from wpaulino April 25, 2025 13:16
@tnull tnull requested a review from TheBlueMatt April 25, 2025 16:02
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.

Confirmed I get the same output by running cargo fmt

Copy link
Contributor

@valentinewallace valentinewallace left a 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 :)

Comment on lines +879 to +897
'a,
'b,
'c,
'd,
'e,
'f,
'logger,
'h,
'i,
'j,
'graph,
'k,
'mr,
SD,
M,
T,
F,
C,
L,
Copy link
Contributor

Choose a reason for hiding this comment

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

sheesh

Copy link
Contributor

@benthecarman benthecarman left a 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

@joostjager joostjager requested review from jkczyz and wpaulino April 25, 2025 21:47
Comment on lines +3729 to +3730
flags & FundedStateFlags::ALL
== FundedStateFlags::LOCAL_SHUTDOWN_SENT
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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.

@joostjager joostjager requested a review from jkczyz April 26, 2025 00:09
@joostjager joostjager added the weekly goal Someone wants to land this this week label Apr 26, 2025
@ldk-reviews-bot
Copy link

🔔 1st Reminder

Hey @TheBlueMatt @jkczyz @wpaulino! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

2 similar comments
@ldk-reviews-bot
Copy link

🔔 1st Reminder

Hey @TheBlueMatt @jkczyz @wpaulino! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

@ldk-reviews-bot
Copy link

🔔 1st Reminder

Hey @TheBlueMatt @jkczyz @wpaulino! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

Copy link
Contributor

@carlaKC carlaKC left a 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
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
weekly goal Someone wants to land this this week
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants