Skip to content

Commit

Permalink
Improve collapsible_match error message syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
sobolevn committed Aug 18, 2024
1 parent bfe7f07 commit 4e6fc6f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion clippy_lints/src/matches/collapsible_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ fn check_arm<'tcx>(
// collapsing patterns need an explicit field name in struct pattern matching
// ex: Struct {x: Some(1)}
let replace_msg = if is_innermost_parent_pat_struct {
format!(", prefixed by {}:", snippet(cx, binding_span, "their field name"))
format!(", prefixed by `{}`:", snippet(cx, binding_span, "their field name"))
} else {
String::new()
};
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/collapsible_match.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ help: the outer pattern can be modified to include the inner pattern
LL | if let Issue9647::A { a, .. } = x {
| ^ replace this binding
LL | if let Some(u) = a {
| ^^^^^^^ with this pattern, prefixed by a:
| ^^^^^^^ with this pattern, prefixed by `a`:

error: this `if let` can be collapsed into the outer `if let`
--> tests/ui/collapsible_match.rs:292:9
Expand Down

0 comments on commit 4e6fc6f

Please sign in to comment.