Skip to content

Commit 0e02dc2

Browse files
Rollup merge of #108477 - y21:replace-semi-with-comma-sugg, r=compiler-errors
Make `match` arm comma suggestion more clear Fixes #108472
2 parents ebf8c49 + 32da026 commit 0e02dc2

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

compiler/rustc_parse/locales/en-US.ftl

+1-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ parse_match_arm_body_without_braces = `match` arm body without braces
220220
[one] statement
221221
*[other] statements
222222
} with a body
223-
.suggestion_use_comma_not_semicolon = use a comma to end a `match` arm expression
223+
.suggestion_use_comma_not_semicolon = replace `;` with `,` to end a `match` arm expression
224224
225225
parse_inclusive_range_extra_equals = unexpected `=` after inclusive range
226226
.suggestion_remove_eq = use `..=` instead

tests/ui/parser/match-arm-without-braces.stderr

+7-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@ error: `match` arm body without braces
22
--> $DIR/match-arm-without-braces.rs:26:27
33
|
44
LL | Some(Val::Foo) => 3;
5-
| -- ^- help: use a comma to end a `match` arm expression: `,`
6-
| | |
7-
| | this statement is not surrounded by a body
5+
| -- ^ this statement is not surrounded by a body
6+
| |
87
| while parsing the `match` arm starting here
8+
|
9+
help: replace `;` with `,` to end a `match` arm expression
10+
|
11+
LL | Some(Val::Foo) => 3,
12+
| ~
913

1014
error: `match` arm body without braces
1115
--> $DIR/match-arm-without-braces.rs:31:11

0 commit comments

Comments
 (0)