Rustfmt Maximalism
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.
- First rebase the branch normally onto the predecessor of X (still without formatting) to resolve any outstanding conflicts.
- Create and checkout a new branch for the rewrite off of X.
- Run the following script, replace BRANCH with the branch to replay:
#!/bin/bash
echo Start
BRANCH="2025-04-rustfmt-tests-1"
for commit in $(git rev-list --reverse HEAD..$BRANCH); do
echo "Commit: $commit"
git restore --source=$commit .
cargo fmt
git add .
git commit -c $commit --no-edit --allow-empty
done
- Now every commit in the new branch is rustfmted and exists on top of formatted main.
👋 I see @wpaulino was un-assigned. If you'd like another reviewer assignemnt, please click here.
🔔 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.
🔔 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.
🔔 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.
🔔 2nd 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.
🔔 2nd 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.
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: https://github.com/joostjager/rust-lightning/compare/main-fmt...joostjager:rust-lightning:rustfmt-tests-rewritten
Another option that could be used is #[rustfmt::skip] on the method level, for code that turns out unreadable beyond personal preference.
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.
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. 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.
🔔 3rd 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.
🔔 4th 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.
🔔 4th 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.
🔔 5th 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.
🔔 5th 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.
🔔 6th 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.
🔔 6th 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.
🔔 7th 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.
🔔 7th 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.
🔔 8th 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.
🔔 8th 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.
🔔 9th 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.
🔔 9th 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.
🔔 10th 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.
🔔 10th 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.
🔔 11th 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.
🔔 11th 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.
🔔 12th 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.
🔔 12th 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.