Skip to content

Fix brace placement for multiline control flow - #7005

Merged
ytmimi merged 1 commit into
rust-lang:mainfrom
subotac:fix/multiline-if-let-brace
Aug 22, 2026
Merged

Fix brace placement for multiline control flow#7005
ytmimi merged 1 commit into
rust-lang:mainfrom
subotac:fix/multiline-if-let-brace

Conversation

@subotac

@subotac subotac commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #7003.

The multiline-condition brace check included the surrounding assignment offset when comparing indentation. This incorrectly kept the opening brace on the condition's final line.

For Style Edition 2027, compare against the leading indentation of the control-flow expression, matching the Rust Style Guide. Style Edition 2024 behavior remains unchanged.

Tests

Added source/target regression fixtures for Style Editions 2024 and 2027.

@rustbot rustbot added the S-waiting-on-review Status: awaiting review from the assignee but also interested parties. label Aug 2, 2026
@ytmimi ytmimi added the S-on-hold Status: PR/issue is on hold (due to bandwidth/prioritization/need discussions etc.). label Aug 3, 2026
@ytmimi

ytmimi commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Marking this one as on-hold since I'd like to get a second opinion from someone on the style-team about the original issue.

@ytmimi ytmimi removed the S-on-hold Status: PR/issue is on hold (due to bandwidth/prioritization/need discussions etc.). label Aug 3, 2026
@ytmimi

ytmimi commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Got confirmation that this is an issue.

@ytmimi

ytmimi commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Thanks for gating the formatting changes. This looks good 👍🏻

@ytmimi ytmimi added the A-2027-style-edition Area: style edition 2027 label Aug 22, 2026
@ytmimi
ytmimi added this pull request to the merge queue Aug 22, 2026
Merged via the queue into rust-lang:main with commit 5075b26 Aug 22, 2026
27 checks passed
@rustbot rustbot added release-notes Needs an associated changelog entry and removed S-waiting-on-review Status: awaiting review from the assignee but also interested parties. labels Aug 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-2027-style-edition Area: style edition 2027 release-notes Needs an associated changelog entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rustfmt generated unaligned indent code block

3 participants