Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 7650f0b

Browse files
authored
Merge pull request rust-lang#3483 from chrisduerr/master
Enable overflow_delimited_expr for structs
2 parents dfa94d1 + 919bee8 commit 7650f0b

File tree

3 files changed

+104
-0
lines changed

3 files changed

+104
-0
lines changed

src/expr.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1346,6 +1346,7 @@ pub fn can_be_overflowed_expr(
13461346
ast::ExprKind::Match(..) => {
13471347
(context.use_block_indent() && args_len == 1)
13481348
|| (context.config.indent_style() == IndentStyle::Visual && args_len > 1)
1349+
|| context.config.overflow_delimited_expr()
13491350
}
13501351
ast::ExprKind::If(..)
13511352
| ast::ExprKind::IfLet(..)

tests/source/match_overflow_expr.rs

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// rustfmt-overflow_delimited_expr: true
2+
3+
fn main() {
4+
println!(
5+
"Foobar: {}",
6+
match "input" {
7+
"a" => "",
8+
"b" => "",
9+
"c" => "",
10+
"d" => "",
11+
"e" => "",
12+
"f" => "",
13+
"g" => "",
14+
"h" => "",
15+
"i" => "",
16+
"j" => "",
17+
"k" => "",
18+
"l" => "",
19+
"m" => "",
20+
"n" => "",
21+
"o" => "",
22+
"p" => "",
23+
"q" => "",
24+
"r" => "Rust",
25+
}
26+
);
27+
}
28+
29+
fn main() {
30+
println!(
31+
"Very Long Input String Which Makes It Impossible To Fit On The Same Line: {}",
32+
match "input" {
33+
"a" => "",
34+
"b" => "",
35+
"c" => "",
36+
"d" => "",
37+
"e" => "",
38+
"f" => "",
39+
"g" => "",
40+
"h" => "",
41+
"i" => "",
42+
"j" => "",
43+
"k" => "",
44+
"l" => "",
45+
"m" => "",
46+
"n" => "",
47+
"o" => "",
48+
"p" => "",
49+
"q" => "",
50+
"r" => "Rust",
51+
}
52+
);
53+
}

tests/target/match_overflow_expr.rs

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// rustfmt-overflow_delimited_expr: true
2+
3+
fn main() {
4+
println!("Foobar: {}", match "input" {
5+
"a" => "",
6+
"b" => "",
7+
"c" => "",
8+
"d" => "",
9+
"e" => "",
10+
"f" => "",
11+
"g" => "",
12+
"h" => "",
13+
"i" => "",
14+
"j" => "",
15+
"k" => "",
16+
"l" => "",
17+
"m" => "",
18+
"n" => "",
19+
"o" => "",
20+
"p" => "",
21+
"q" => "",
22+
"r" => "Rust",
23+
});
24+
}
25+
26+
fn main() {
27+
println!(
28+
"Very Long Input String Which Makes It Impossible To Fit On The Same Line: {}",
29+
match "input" {
30+
"a" => "",
31+
"b" => "",
32+
"c" => "",
33+
"d" => "",
34+
"e" => "",
35+
"f" => "",
36+
"g" => "",
37+
"h" => "",
38+
"i" => "",
39+
"j" => "",
40+
"k" => "",
41+
"l" => "",
42+
"m" => "",
43+
"n" => "",
44+
"o" => "",
45+
"p" => "",
46+
"q" => "",
47+
"r" => "Rust",
48+
}
49+
);
50+
}

0 commit comments

Comments
 (0)