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

control_brace_style and match_arm_blocks incompatability #4844

Open
Iron-E opened this issue May 19, 2021 · 1 comment · May be fixed by #5072
Open

control_brace_style and match_arm_blocks incompatability #4844

Iron-E opened this issue May 19, 2021 · 1 comment · May be fixed by #5072
Labels
a-matches match arms, patterns, blocks, etc e-trailing whitespace error[internal]: left behind trailing whitespace only-with-option requires a non-default option value to reproduce p-low

Comments

@Iron-E
Copy link

Iron-E commented May 19, 2021

Coming from #3373.

There seems to be an issue which sometimes occurs whenever these two options are present at the same time in a rustfmt configuration:

control_brace_style = 'AlwaysNextLine'
match_arm_blocks = false

For example, take the following snippet from a cargo new main.rs file:

fn main() {
	let fooooooo = "100000000000000000000000";
	let _bar = match fooooooo {
		"100000000000000000000000" => fooooooo.len() == 1 && fooooooo.contains("222222222222222222"),
		_ => unreachable!("Should not happen"),
	};
}

Running cargo fmt on this code results in the following error:

error[internal]: left behind trailing whitespace
 --> /home/iron-e/Programming/ACTIVE/rustfmt-error-example/src/main.rs:6:6:1
  |
6 |
  | ^^^^^^^^
  |

warning: rustfmt has failed to format. See previous 1 errors.

It seems that line 4 of the snippet being >=95 characters long has something to do with it. The rest of the code is just filler to get it to compile.

@Iron-E Iron-E changed the title control_brace_style and match_arm_blocks incompatability control_brace_style and match_arm_blocks incompatability May 19, 2021
@calebcartwright calebcartwright added a-matches match arms, patterns, blocks, etc only-with-option requires a non-default option value to reproduce labels May 20, 2021
@mujpao mujpao linked a pull request Nov 9, 2021 that will close this issue
@ytmimi ytmimi added e-trailing whitespace error[internal]: left behind trailing whitespace p-low labels Jul 22, 2022
@ytmimi
Copy link
Contributor

ytmimi commented Jul 27, 2022

linking tracking issue for control_brace_style #3377 and match_arm_blocks #3373

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-matches match arms, patterns, blocks, etc e-trailing whitespace error[internal]: left behind trailing whitespace only-with-option requires a non-default option value to reproduce p-low
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants