Merge pull request #3483 from chrisduerr/master

Enable overflow_delimited_expr for structs
This commit is contained in:
Seiichi Uchida 2019-03-31 21:30:49 +09:00 committed by GitHub
commit 7650f0bc8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 104 additions and 0 deletions

View File

@ -1346,6 +1346,7 @@ pub fn can_be_overflowed_expr(
ast::ExprKind::Match(..) => {
(context.use_block_indent() && args_len == 1)
|| (context.config.indent_style() == IndentStyle::Visual && args_len > 1)
|| context.config.overflow_delimited_expr()
}
ast::ExprKind::If(..)
| ast::ExprKind::IfLet(..)

View File

@ -0,0 +1,53 @@
// rustfmt-overflow_delimited_expr: true
fn main() {
println!(
"Foobar: {}",
match "input" {
"a" => "",
"b" => "",
"c" => "",
"d" => "",
"e" => "",
"f" => "",
"g" => "",
"h" => "",
"i" => "",
"j" => "",
"k" => "",
"l" => "",
"m" => "",
"n" => "",
"o" => "",
"p" => "",
"q" => "",
"r" => "Rust",
}
);
}
fn main() {
println!(
"Very Long Input String Which Makes It Impossible To Fit On The Same Line: {}",
match "input" {
"a" => "",
"b" => "",
"c" => "",
"d" => "",
"e" => "",
"f" => "",
"g" => "",
"h" => "",
"i" => "",
"j" => "",
"k" => "",
"l" => "",
"m" => "",
"n" => "",
"o" => "",
"p" => "",
"q" => "",
"r" => "Rust",
}
);
}

View File

@ -0,0 +1,50 @@
// rustfmt-overflow_delimited_expr: true
fn main() {
println!("Foobar: {}", match "input" {
"a" => "",
"b" => "",
"c" => "",
"d" => "",
"e" => "",
"f" => "",
"g" => "",
"h" => "",
"i" => "",
"j" => "",
"k" => "",
"l" => "",
"m" => "",
"n" => "",
"o" => "",
"p" => "",
"q" => "",
"r" => "Rust",
});
}
fn main() {
println!(
"Very Long Input String Which Makes It Impossible To Fit On The Same Line: {}",
match "input" {
"a" => "",
"b" => "",
"c" => "",
"d" => "",
"e" => "",
"f" => "",
"g" => "",
"h" => "",
"i" => "",
"j" => "",
"k" => "",
"l" => "",
"m" => "",
"n" => "",
"o" => "",
"p" => "",
"q" => "",
"r" => "Rust",
}
);
}