Skip to content

Make match arm comma suggestion more clear #108477

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

Merged
merged 1 commit into from
Feb 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_parse/locales/en-US.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ parse_match_arm_body_without_braces = `match` arm body without braces
[one] statement
*[other] statements
} with a body
.suggestion_use_comma_not_semicolon = use a comma to end a `match` arm expression
.suggestion_use_comma_not_semicolon = replace `;` with `,` to end a `match` arm expression

parse_inclusive_range_extra_equals = unexpected `=` after inclusive range
.suggestion_remove_eq = use `..=` instead
Expand Down
10 changes: 7 additions & 3 deletions tests/ui/parser/match-arm-without-braces.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ error: `match` arm body without braces
--> $DIR/match-arm-without-braces.rs:26:27
|
LL | Some(Val::Foo) => 3;
| -- ^- help: use a comma to end a `match` arm expression: `,`
| | |
| | this statement is not surrounded by a body
| -- ^ this statement is not surrounded by a body
| |
| while parsing the `match` arm starting here
|
help: replace `;` with `,` to end a `match` arm expression
|
LL | Some(Val::Foo) => 3,
| ~

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