diff options
| author | flip1995 <hello@philkrones.com> | 2019-02-16 19:35:15 +0100 |
|---|---|---|
| committer | flip1995 <hello@philkrones.com> | 2019-02-19 21:34:14 +0100 |
| commit | 87ae6c8bc989c99435afec478a31fca7e319a17d (patch) | |
| tree | fcdbdf10e21d6f4827056891925775e309314cb9 | |
| parent | 1a86d80c1085c7415f97c8fb446f39f2ed80c6b4 (diff) | |
| download | rust-87ae6c8bc989c99435afec478a31fca7e319a17d.tar.gz rust-87ae6c8bc989c99435afec478a31fca7e319a17d.zip | |
Fix ice-3719
| -rw-r--r-- | clippy_lints/src/matches.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/clippy_lints/src/matches.rs b/clippy_lints/src/matches.rs index fcff1e16f38..bb337c067ba 100644 --- a/clippy_lints/src/matches.rs +++ b/clippy_lints/src/matches.rs @@ -570,13 +570,15 @@ fn check_match_ref_pats(cx: &LateContext<'_, '_>, ex: &Expr, arms: &[Arm], expr: if has_only_ref_pats(arms) { let mut suggs = Vec::new(); let (title, msg) = if let ExprKind::AddrOf(Mutability::MutImmutable, ref inner) = ex.node { - suggs.push((ex.span, Sugg::hir(cx, inner, "..").to_string())); + let span = ex.span.source_callsite(); + suggs.push((span, Sugg::hir_with_macro_callsite(cx, inner, "..").to_string())); ( "you don't need to add `&` to both the expression and the patterns", "try", ) } else { - suggs.push((ex.span, Sugg::hir(cx, ex, "..").deref().to_string())); + let span = ex.span.source_callsite(); + suggs.push((span, Sugg::hir_with_macro_callsite(cx, ex, "..").deref().to_string())); ( "you don't need to add `&` to all patterns", "instead of prefixing all patterns with `&`, you can dereference the expression", |
