diff options
| author | bors <bors@rust-lang.org> | 2024-08-18 20:07:17 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-08-18 20:07:17 +0000 |
| commit | 45720b7aa145c3d9e2d9629416141d8a88501786 (patch) | |
| tree | e581e624059251f727e194c06430f7bfe7b7ff61 | |
| parent | bfe7f070bd79a9373ab58d0e2f64ef3400834b68 (diff) | |
| parent | 4e6fc6fa052d3278a5bf11ba805d292f5a5ecb4a (diff) | |
| download | rust-45720b7aa145c3d9e2d9629416141d8a88501786.tar.gz rust-45720b7aa145c3d9e2d9629416141d8a88501786.zip | |
Auto merge of #13284 - sobolevn:issue-13283, r=y21
Improve `collapsible_match` error message syntax fixes #13283 changelog: none
| -rw-r--r-- | clippy_lints/src/matches/collapsible_match.rs | 2 | ||||
| -rw-r--r-- | tests/ui/collapsible_match.stderr | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/clippy_lints/src/matches/collapsible_match.rs b/clippy_lints/src/matches/collapsible_match.rs index 90cfdecc199..b666e77c09e 100644 --- a/clippy_lints/src/matches/collapsible_match.rs +++ b/clippy_lints/src/matches/collapsible_match.rs @@ -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() }; diff --git a/tests/ui/collapsible_match.stderr b/tests/ui/collapsible_match.stderr index 01944baee79..1da78b56239 100644 --- a/tests/ui/collapsible_match.stderr +++ b/tests/ui/collapsible_match.stderr @@ -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 |
