Skip to content

Commit 1000fc5

Browse files
committed
Don't emit suggestion when inside of a macro
1 parent a2c9d10 commit 1000fc5

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

clippy_lints/src/matches.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ use std::collections::Bound;
1818
use crate::syntax::ast::LitKind;
1919
use crate::syntax::source_map::Span;
2020
use crate::utils::paths;
21-
use crate::utils::{expr_block, is_allowed, is_expn_of, match_qpath, match_type, multispan_sugg,
22-
remove_blocks, snippet, span_lint_and_sugg, span_lint_and_then,
23-
span_note_and_lint, walk_ptrs_ty};
21+
use crate::utils::{expr_block, in_macro, is_allowed, is_expn_of, match_qpath, match_type,
22+
multispan_sugg, remove_blocks, snippet, span_lint_and_sugg, span_lint_and_then,
23+
span_note_and_lint, walk_ptrs_ty};
2424
use crate::utils::sugg::Sugg;
2525
use crate::consts::{constant, Constant};
2626
use crate::rustc_errors::Applicability;
@@ -457,7 +457,9 @@ fn check_match_ref_pats(cx: &LateContext<'_, '_>, ex: &Expr, arms: &[Arm], expr:
457457
}));
458458

459459
span_lint_and_then(cx, MATCH_REF_PATS, expr.span, title, |db| {
460-
multispan_sugg(db, msg.to_owned(), suggs);
460+
if !in_macro(expr.span) {
461+
multispan_sugg(db, msg.to_owned(), suggs);
462+
}
461463
});
462464
}
463465
}

0 commit comments

Comments
 (0)