Skip to content

Commit 4cd97a9

Browse files
committed
Fix fallout in similar_names
1 parent ac37507 commit 4cd97a9

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

clippy_lints/src/non_expressive_names.rs

+9
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use rustc_ast::ast::{
55
use rustc_ast::attr;
66
use rustc_ast::visit::{walk_block, walk_expr, walk_pat, Visitor};
77
use rustc_lint::{EarlyContext, EarlyLintPass};
8+
use rustc_middle::lint::in_external_macro;
89
use rustc_session::{declare_tool_lint, impl_lint_pass};
910
use rustc_span::source_map::Span;
1011
use rustc_span::symbol::{Ident, SymbolStr};
@@ -354,12 +355,20 @@ impl<'a, 'tcx> Visitor<'tcx> for SimilarNamesLocalVisitor<'a, 'tcx> {
354355

355356
impl EarlyLintPass for NonExpressiveNames {
356357
fn check_item(&mut self, cx: &EarlyContext<'_>, item: &Item) {
358+
if in_external_macro(cx.sess, item.span) {
359+
return;
360+
}
361+
357362
if let ItemKind::Fn(_, ref sig, _, Some(ref blk)) = item.kind {
358363
do_check(self, cx, &item.attrs, &sig.decl, blk);
359364
}
360365
}
361366

362367
fn check_impl_item(&mut self, cx: &EarlyContext<'_>, item: &AssocItem) {
368+
if in_external_macro(cx.sess, item.span) {
369+
return;
370+
}
371+
363372
if let AssocItemKind::Fn(_, ref sig, _, Some(ref blk)) = item.kind {
364373
do_check(self, cx, &item.attrs, &sig.decl, blk);
365374
}

0 commit comments

Comments
 (0)