Skip to content

Enforce match_arm_blocks = true for consistent formatting#10958

Open
pgherveou wants to merge 12 commits intomasterfrom
pg/match-arm-blocks-true
Open

Enforce match_arm_blocks = true for consistent formatting#10958
pgherveou wants to merge 12 commits intomasterfrom
pg/match-arm-blocks-true

Conversation

@pgherveou
Copy link
Contributor

Summary

Flips match_arm_blocks from false to true to ensure all multi-line match arm bodies are wrapped in braces consistently.

Problem

With match_arm_blocks = false, rustfmt doesn't add braces to multi-line match arms, but it also doesn't remove existing braces. This means both styles are valid:

// Style A (no braces)
AccountIdOrAddress::AccountId(id) =>
    <T::AddressMapper as AddressMapper<T>>::to_address(id),

// Style B (with braces) - also valid, rustfmt won't change it
AccountIdOrAddress::AccountId(id) => {
    <T::AddressMapper as AddressMapper<T>>::to_address(id)
},

LLMs tend to produce Style B, which creates unnecessary diff noise in PRs.

Solution

Set match_arm_blocks = true to enforce Style B everywhere. Now there's exactly one valid style, eliminating the ambiguity.

Impact

556 files changed — this is a one-time formatting update. All future code will be consistently formatted.

Follow-up to #10939.

@pgherveou pgherveou requested review from a team, acatangiu and koute as code owners February 2, 2026 19:51
@pgherveou
Copy link
Contributor Author

@bkchr follow up from #10939
these changes are also annoying with llm, should we go with this despite the big diff

Copy link
Member

@bkchr bkchr left a comment

Choose a reason for hiding this comment

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

😿

@pgherveou pgherveou added the R0-no-crate-publish-required The change does not require any crates to be re-published. label Feb 2, 2026
@paritytech-review-bot paritytech-review-bot bot requested a review from a team February 3, 2026 15:23
Flips match_arm_blocks from false to true to ensure all multi-line
match arm bodies are wrapped in braces consistently.

This prevents style drift when LLMs generate code with braces that
rustfmt previously wouldn't remove (since the braced form was valid).
Now there's only one valid style: always use braces for multi-line
match arms.

Follow-up to #10939.
Automated formatting pass to wrap multi-line match arm bodies in braces.
@pgherveou pgherveou force-pushed the pg/match-arm-blocks-true branch from 8a93990 to 9cd05ae Compare February 4, 2026 08:42
@paritytech paritytech deleted a comment from cla-bot-2021 bot Feb 4, 2026
@pgherveou pgherveou enabled auto-merge February 4, 2026 12:58
pgherveou and others added 4 commits February 4, 2026 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

R0-no-crate-publish-required The change does not require any crates to be re-published.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants