@@ -6,7 +6,7 @@ use clippy_utils::msrvs;
66use clippy_utils:: source:: { first_line_of_span, is_present_in_source, snippet_opt, without_block_comments} ;
77use clippy_utils:: { extract_msrv_attr, meets_msrv} ;
88use if_chain:: if_chain;
9- use rustc_ast:: { AttrKind , AttrStyle , Attribute , Lit , LitKind , MacArgs , MacArgsEq , MetaItemKind , NestedMetaItem } ;
9+ use rustc_ast:: { AttrKind , AttrStyle , Attribute , Lit , LitKind , MetaItemKind , NestedMetaItem } ;
1010use rustc_errors:: Applicability ;
1111use rustc_hir:: {
1212 Block , Expr , ExprKind , ImplItem , ImplItemKind , Item , ItemKind , StmtKind , TraitFn , TraitItem , TraitItemKind ,
@@ -586,21 +586,10 @@ impl EarlyLintPass for EarlyAttributes {
586586
587587fn check_empty_line_after_outer_attr ( cx : & EarlyContext < ' _ > , item : & rustc_ast:: Item ) {
588588 for attr in & item. attrs {
589- let attr_item = if let AttrKind :: Normal ( ref attr, _) = attr. kind {
590- attr
591- } else {
592- return ;
593- } ;
594-
595- if attr. style == AttrStyle :: Outer {
596- if let MacArgs :: Eq ( _, MacArgsEq :: Ast ( expr) ) = & attr_item. args
597- && !matches ! ( expr. kind, rustc_ast:: ExprKind :: Lit ( ..) ) {
598- return ;
599- }
600- if attr_item. args . inner_tokens ( ) . is_empty ( ) || !is_present_in_source ( cx, attr. span ) {
601- return ;
602- }
603-
589+ if matches ! ( attr. kind, AttrKind :: Normal ( ..) )
590+ && attr. style == AttrStyle :: Outer
591+ && is_present_in_source ( cx, attr. span )
592+ {
604593 let begin_of_attr_to_item = Span :: new ( attr. span . lo ( ) , item. span . lo ( ) , item. span . ctxt ( ) , item. span . parent ( ) ) ;
605594 let end_of_attr_to_item = Span :: new ( attr. span . hi ( ) , item. span . lo ( ) , item. span . ctxt ( ) , item. span . parent ( ) ) ;
606595
0 commit comments