@@ -6,7 +6,7 @@ use clippy_utils::msrvs;
6
6
use clippy_utils:: source:: { first_line_of_span, is_present_in_source, snippet_opt, without_block_comments} ;
7
7
use clippy_utils:: { extract_msrv_attr, meets_msrv} ;
8
8
use 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 } ;
10
10
use rustc_errors:: Applicability ;
11
11
use rustc_hir:: {
12
12
Block , Expr , ExprKind , ImplItem , ImplItemKind , Item , ItemKind , StmtKind , TraitFn , TraitItem , TraitItemKind ,
@@ -586,21 +586,10 @@ impl EarlyLintPass for EarlyAttributes {
586
586
587
587
fn check_empty_line_after_outer_attr ( cx : & EarlyContext < ' _ > , item : & rustc_ast:: Item ) {
588
588
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
+ {
604
593
let begin_of_attr_to_item = Span :: new ( attr. span . lo ( ) , item. span . lo ( ) , item. span . ctxt ( ) , item. span . parent ( ) ) ;
605
594
let end_of_attr_to_item = Span :: new ( attr. span . hi ( ) , item. span . lo ( ) , item. span . ctxt ( ) , item. span . parent ( ) ) ;
606
595
@@ -624,7 +613,7 @@ fn check_empty_line_after_outer_attr(cx: &EarlyContext<'_>, item: &rustc_ast::It
624
613
625
614
fn check_deprecated_cfg_attr ( cx : & EarlyContext < ' _ > , attr : & Attribute , msrv : Option < RustcVersion > ) {
626
615
if_chain ! {
627
- if meets_msrv( msrv. as_ref ( ) , & msrvs:: TOOL_ATTRIBUTES ) ;
616
+ if meets_msrv( msrv, msrvs:: TOOL_ATTRIBUTES ) ;
628
617
// check cfg_attr
629
618
if attr. has_name( sym:: cfg_attr) ;
630
619
if let Some ( items) = attr. meta_item_list( ) ;
0 commit comments