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