Don't emit suggestion when inside of a macro

This commit is contained in:
flip1995 2018-11-15 17:03:17 +01:00
parent a2c9d10da5
commit 1000fc5120
No known key found for this signature in database
GPG Key ID: E8E897A5870E41C2
1 changed files with 6 additions and 4 deletions

View File

@ -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);
}
});
}
}