diff options
| author | flip1995 <hello@philkrones.com> | 2018-11-15 17:03:17 +0100 |
|---|---|---|
| committer | flip1995 <hello@philkrones.com> | 2018-11-15 17:03:17 +0100 |
| commit | 1000fc5120b0c58649f8a09811982d4dcfebeba8 (patch) | |
| tree | b2bcd5d8eda7a7597e35d5a77ae5062441d37eaf /clippy_lints | |
| parent | a2c9d10da581cac9eb45d2c06124bc4eba9b280a (diff) | |
| download | rust-1000fc5120b0c58649f8a09811982d4dcfebeba8.tar.gz rust-1000fc5120b0c58649f8a09811982d4dcfebeba8.zip | |
Don't emit suggestion when inside of a macro
Diffstat (limited to 'clippy_lints')
| -rw-r--r-- | clippy_lints/src/matches.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/clippy_lints/src/matches.rs b/clippy_lints/src/matches.rs index 4a704c3d52e..9e2dac8fef1 100644 --- a/clippy_lints/src/matches.rs +++ b/clippy_lints/src/matches.rs @@ -18,9 +18,9 @@ use std::collections::Bound; use crate::syntax::ast::LitKind; use crate::syntax::source_map::Span; use crate::utils::paths; -use crate::utils::{expr_block, is_allowed, is_expn_of, match_qpath, match_type, multispan_sugg, - remove_blocks, snippet, span_lint_and_sugg, span_lint_and_then, - span_note_and_lint, walk_ptrs_ty}; +use crate::utils::{expr_block, in_macro, is_allowed, is_expn_of, match_qpath, match_type, + multispan_sugg, remove_blocks, snippet, span_lint_and_sugg, span_lint_and_then, + span_note_and_lint, walk_ptrs_ty}; use crate::utils::sugg::Sugg; use crate::consts::{constant, Constant}; use crate::rustc_errors::Applicability; @@ -457,7 +457,9 @@ fn check_match_ref_pats(cx: &LateContext<'_, '_>, ex: &Expr, arms: &[Arm], expr: })); span_lint_and_then(cx, MATCH_REF_PATS, expr.span, title, |db| { - multispan_sugg(db, msg.to_owned(), suggs); + if !in_macro(expr.span) { + multispan_sugg(db, msg.to_owned(), suggs); + } }); } } |
