@@ -5,6 +5,7 @@ use rustc_ast::ast::{
5
5
use rustc_ast:: attr;
6
6
use rustc_ast:: visit:: { walk_block, walk_expr, walk_pat, Visitor } ;
7
7
use rustc_lint:: { EarlyContext , EarlyLintPass } ;
8
+ use rustc_middle:: lint:: in_external_macro;
8
9
use rustc_session:: { declare_tool_lint, impl_lint_pass} ;
9
10
use rustc_span:: source_map:: Span ;
10
11
use rustc_span:: symbol:: { Ident , SymbolStr } ;
@@ -354,12 +355,20 @@ impl<'a, 'tcx> Visitor<'tcx> for SimilarNamesLocalVisitor<'a, 'tcx> {
354
355
355
356
impl EarlyLintPass for NonExpressiveNames {
356
357
fn check_item ( & mut self , cx : & EarlyContext < ' _ > , item : & Item ) {
358
+ if in_external_macro ( cx. sess , item. span ) {
359
+ return ;
360
+ }
361
+
357
362
if let ItemKind :: Fn ( _, ref sig, _, Some ( ref blk) ) = item. kind {
358
363
do_check ( self , cx, & item. attrs , & sig. decl , blk) ;
359
364
}
360
365
}
361
366
362
367
fn check_impl_item ( & mut self , cx : & EarlyContext < ' _ > , item : & AssocItem ) {
368
+ if in_external_macro ( cx. sess , item. span ) {
369
+ return ;
370
+ }
371
+
363
372
if let AssocItemKind :: Fn ( _, ref sig, _, Some ( ref blk) ) = item. kind {
364
373
do_check ( self , cx, & item. attrs , & sig. decl , blk) ;
365
374
}
0 commit comments