Skip to content
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

Fixed error caused by combination of match_arm_blocks and control_brace_style #5923

Merged
merged 3 commits into from
Oct 24, 2023

Conversation

GambitingMan
Copy link
Contributor

Fixes #5912

When control_brace_style = "AlwaysNextLine", the code seems to always assume that body_prefix is {. This is however not the case when match_arm_blocks = false. This causes block_sep to introduce extra white space that causes the error.

The fix was to check if body_prefix is empty before matching on ControlBraceStyle::AlwaysNextLine. If you prefer however, I can add a match guard instead of changing the ordering of the match arms.

@ytmimi
Copy link
Contributor

ytmimi commented Oct 3, 2023

Code changes look good to me. The last thing I'd ask for is a test case similar to this one where we set control_brace_style = "AlwaysNextLine", and match_arm_blocks = false, and ensure that error[internal]: left behind trailing whitespace is not output to stderr.

@GambitingMan
Copy link
Contributor Author

Thanks for the review. I've added the test you requested.

@ytmimi ytmimi force-pushed the control_brace_style_error branch from d9b6490 to 6ac4fdb Compare October 23, 2023 23:57
Copy link
Contributor

@ytmimi ytmimi left a comment

Choose a reason for hiding this comment

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

Thanks again for your work on this! I think we're good to go here. Will likely get this merged after CI passes. Also running our Diff-Check job

@ytmimi ytmimi added release-notes Needs an associated changelog entry and removed pr-waiting-on-author labels Oct 24, 2023
@ytmimi ytmimi merged commit 041f113 into rust-lang:master Oct 24, 2023
27 checks passed
@GambitingMan GambitingMan deleted the control_brace_style_error branch October 27, 2023 19:35
@ytmimi ytmimi removed the release-notes Needs an associated changelog entry label Jul 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

brace_style AlwaysNextLine fails on nightly
3 participants