@@ -7,14 +7,14 @@ use rustc_hir::attrs::AttributeKind;
77use rustc_hir:: { AttrItem , Attribute , MethodKind , Target } ;
88use rustc_span:: { BytePos , FileName , RemapPathScopeComponents , Span , Symbol , sym} ;
99
10- use crate :: AttributeParser ;
1110use crate :: context:: AcceptContext ;
1211use crate :: errors:: {
1312 InvalidAttrAtCrateLevel , InvalidTargetLint , ItemFollowingInnerAttr ,
1413 UnsupportedAttributesInWhere ,
1514} ;
1615use crate :: session_diagnostics:: InvalidTarget ;
1716use crate :: target_checking:: Policy :: Allow ;
17+ use crate :: { AttributeParser , ShouldEmit } ;
1818
1919#[ derive( Debug ) ]
2020pub ( crate ) enum AllowedTargets {
@@ -92,6 +92,10 @@ impl<'sess> AttributeParser<'sess> {
9292 allowed_targets : & AllowedTargets ,
9393 cx : & mut AcceptContext < ' _ , ' sess > ,
9494 ) {
95+ if matches ! ( cx. should_emit, ShouldEmit :: Nothing ) {
96+ return ;
97+ }
98+
9599 // For crate-level attributes we emit a specific set of lints to warn
96100 // people about accidentally not using them on the crate.
97101 if let & AllowedTargets :: AllowList ( & [ Allow ( Target :: Crate ) ] ) = allowed_targets {
0 commit comments