Enforce match_arm_blocks = true for consistent formatting#10958
Open
Enforce match_arm_blocks = true for consistent formatting#10958
Conversation
Contributor
Author
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.
8a93990 to
9cd05ae
Compare
xermicus
approved these changes
Feb 4, 2026
ggwpez
approved these changes
Feb 4, 2026
Adds all crates flagged by the semver CI check with bump: none since this is a formatting-only change (match_arm_blocks rustfmt option).
lrubasze
approved these changes
Feb 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Flips
match_arm_blocksfromfalsetotrueto 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:LLMs tend to produce Style B, which creates unnecessary diff noise in PRs.
Solution
Set
match_arm_blocks = trueto 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.