Skip to content

Commit 87ae6c8

Browse files
committed
Fix ice-3719
1 parent 1a86d80 commit 87ae6c8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

clippy_lints/src/matches.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -570,13 +570,15 @@ fn check_match_ref_pats(cx: &LateContext<'_, '_>, ex: &Expr, arms: &[Arm], expr:
570570
if has_only_ref_pats(arms) {
571571
let mut suggs = Vec::new();
572572
let (title, msg) = if let ExprKind::AddrOf(Mutability::MutImmutable, ref inner) = ex.node {
573-
suggs.push((ex.span, Sugg::hir(cx, inner, "..").to_string()));
573+
let span = ex.span.source_callsite();
574+
suggs.push((span, Sugg::hir_with_macro_callsite(cx, inner, "..").to_string()));
574575
(
575576
"you don't need to add `&` to both the expression and the patterns",
576577
"try",
577578
)
578579
} else {
579-
suggs.push((ex.span, Sugg::hir(cx, ex, "..").deref().to_string()));
580+
let span = ex.span.source_callsite();
581+
suggs.push((span, Sugg::hir_with_macro_callsite(cx, ex, "..").deref().to_string()));
580582
(
581583
"you don't need to add `&` to all patterns",
582584
"instead of prefixing all patterns with `&`, you can dereference the expression",

0 commit comments

Comments
 (0)