Skip to content

control_brace_style and match_arm_blocks incompatability #4844

Open
@Iron-E

Description

@Iron-E

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    a-matchesmatch arms, patterns, blocks, etce-trailing whitespaceerror[internal]: left behind trailing whitespaceonly-with-optionrequires a non-default option value to reproducep-low

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions