Skip to content

Commit a212bd4

Browse files
committed
misc: put the : in the right place in the struct field suggestion
1 parent d254020 commit a212bd4

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

clippy_lints/src/matches/collapsible_match.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ fn check_arm<'tcx>(
103103
// collapsing patterns need an explicit field name in struct pattern matching
104104
// ex: Struct {x: Some(1)}
105105
let replace_msg = if is_innermost_parent_pat_struct {
106-
format!(", prefixed by `{}`:", snippet(cx, binding_span, "their field name"))
106+
format!(", prefixed by `{}: `", snippet(cx, binding_span, "their field name"))
107107
} else {
108108
String::new()
109109
};

tests/ui/collapsible_match.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ help: the outer pattern can be modified to include the inner pattern
230230
LL | if let Issue9647::A { a, .. } = x {
231231
| ^ replace this binding
232232
LL | if let Some(u) = a {
233-
| ^^^^^^^ with this pattern, prefixed by `a`:
233+
| ^^^^^^^ with this pattern, prefixed by `a: `
234234

235235
error: this `if let` can be collapsed into the outer `if let`
236236
--> tests/ui/collapsible_match.rs:299:9

0 commit comments

Comments
 (0)