-
Notifications
You must be signed in to change notification settings - Fork 909
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
Fail to format match arm when other arm has long line #3156
Comments
Might be a duplicate of/related to #3135 |
I can confirm that this is reproducible on |
I believe this is also a duplicate of #3416 and #3863 If we remove the call to Input fn f() {
let mut a = Vec::new();
match 0 {
0 => {let a=0;""}
_ => r#"
--------------------loong line----------------------------------------------------------------------.
"#,
};
} Output fn f() {
let mut a = Vec::new();
match 0 {
0 => {
let a = 0;
""
}
_ => {
r#"
--------------------loong line----------------------------------------------------------------------.
"#
}
};
} |
…braheemdev Fix long lines which rustfmt fails to format rustfmt fails to format this match expression, because it has several long string literals over the maximum line width. This seems to exhibit rustfmt issues [rust-lang#3863](rust-lang/rustfmt#3863) (Gives up on chains if any line is too long) and [rust-lang#3156](rust-lang/rustfmt#3156) (Fail to format match arm when other arm has long line). Format it with a large line width (e.g., by setting `max_width = 200` in rustfmt.toml) and, in case the rustfmt bugs are later fixed, mark it with `#[rustfmt::skip]`, as it is more legible with each case on one line.
…braheemdev Fix long lines which rustfmt fails to format rustfmt fails to format this match expression, because it has several long string literals over the maximum line width. This seems to exhibit rustfmt issues [rust-lang#3863](rust-lang/rustfmt#3863) (Gives up on chains if any line is too long) and [rust-lang#3156](rust-lang/rustfmt#3156) (Fail to format match arm when other arm has long line). Format it with a large line width (e.g., by setting `max_width = 200` in rustfmt.toml) and, in case the rustfmt bugs are later fixed, mark it with `#[rustfmt::skip]`, as it is more legible with each case on one line.
Rollup merge of rust-lang#136606 - thaliaarchi:format-long-lines, r=ibraheemdev Fix long lines which rustfmt fails to format rustfmt fails to format this match expression, because it has several long string literals over the maximum line width. This seems to exhibit rustfmt issues [rust-lang#3863](rust-lang/rustfmt#3863) (Gives up on chains if any line is too long) and [rust-lang#3156](rust-lang/rustfmt#3156) (Fail to format match arm when other arm has long line). Format it with a large line width (e.g., by setting `max_width = 200` in rustfmt.toml) and, in case the rustfmt bugs are later fixed, mark it with `#[rustfmt::skip]`, as it is more legible with each case on one line.
Rustfmt is not formatting the
let a=0;
part in this reduced testcase:I am using rustfmt version:
rustfmt 0.99.6-nightly (750b252 2018-10-18)
The text was updated successfully, but these errors were encountered: