Skip to content

Commit ca644fb

Browse files
committed
Fix ice-3719
1 parent 685310c commit ca644fb

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
@@ -497,13 +497,15 @@ fn check_match_ref_pats(cx: &LateContext<'_, '_>, ex: &Expr, arms: &[Arm], expr:
497497
if has_only_ref_pats(arms) {
498498
let mut suggs = Vec::new();
499499
let (title, msg) = if let ExprKind::AddrOf(Mutability::MutImmutable, ref inner) = ex.node {
500-
suggs.push((ex.span, Sugg::hir(cx, inner, "..").to_string()));
500+
let span = ex.span.source_callsite();
501+
suggs.push((span, Sugg::hir_with_macro_callsite(cx, inner, "..").to_string()));
501502
(
502503
"you don't need to add `&` to both the expression and the patterns",
503504
"try",
504505
)
505506
} else {
506-
suggs.push((ex.span, Sugg::hir(cx, ex, "..").deref().to_string()));
507+
let span = ex.span.source_callsite();
508+
suggs.push((span, Sugg::hir_with_macro_callsite(cx, ex, "..").deref().to_string()));
507509
(
508510
"you don't need to add `&` to all patterns",
509511
"instead of prefixing all patterns with `&`, you can dereference the expression",

0 commit comments

Comments
 (0)