-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Enforce stricter rustfmt rules to prevent style ambiguity #10939
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
a71d201 to
ca8900c
Compare
327d5a0 to
3c2df5b
Compare
|
/cmd fmt |
AndreiEres
left a comment
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.
group_imports - Would enforce import grouping order (std → external → crate) but causes massive import reordering across the codebase
So we should prefer grouping imports already, right?
I always combine all the imports and not group them. |
|
the only one I would add maybe is edition -> 2024, since this is a disturbing change we are better off doing it now, wdyt? |
|
All GitHub workflows were cancelled due to failure one of the required jobs. |
by default rustfmt preserve local style, and Claude loves to add semi or bracket where there were none before,
We should make the formatting more strict as this is a bit annoying to remind it constantly not to make unnecessary diff.
Summary
The PR is just updating https://github.com/paritytech/polkadot-sdk/blob/pg/stricter-rustfmt-rules/.rustfmt.toml
every other changes are just the result of running the linter
match_arm_leading_pipesfrom "Preserve" to "Never" to enforce a single styletrailing_semicolonfrom false to true to enforcereturn 42;false unfortunately preserve the local stylenormalize_comments = trueto normalize comment spacing (e.g.,// commentnot//comment)normalize_doc_attributes = trueto enforce///over#[doc = ""]These changes ensure only one valid formatting style exists, reducing unnecessary diffs in pull requests caused by different but equally valid formatting styles.
Not changed (for now)
The following options also default to "Preserve" but were intentionally not changed due to (even) larger diff impact:
group_imports- Would enforce import grouping order (std → external → crate) but causes massive import reordering across the codebasehex_literal_case- Would enforce0xABCDvs0xabcdconsistencyThese could be considered in a future PR if the one-time diff cost is acceptable.