@@ -10,6 +10,7 @@ use rustc_span::sym;
1010use crate :: AttributeParser ;
1111use crate :: context:: { AcceptContext , Stage } ;
1212use crate :: session_diagnostics:: InvalidTarget ;
13+ use crate :: target_checking:: Policy :: Allow ;
1314
1415#[ derive( Debug ) ]
1516pub ( crate ) enum AllowedTargets {
@@ -88,7 +89,9 @@ impl<'sess, S: Stage> AttributeParser<'sess, S> {
8889 target : Target ,
8990 cx : & mut AcceptContext < ' _ , ' sess , S > ,
9091 ) {
91- if allowed_targets. allowed_targets ( ) == & [ Target :: Crate ] {
92+ // For crate-level attributes we emit a specific set of lints to warn
93+ // people about accidentally not using them on the crate.
94+ if let & AllowedTargets :: AllowList ( & [ Allow ( Target :: Crate ) ] ) = allowed_targets {
9295 Self :: check_crate_level ( target, cx) ;
9396 return ;
9497 }
@@ -146,8 +149,6 @@ impl<'sess, S: Stage> AttributeParser<'sess, S> {
146149 }
147150
148151 pub ( crate ) fn check_crate_level ( target : Target , cx : & mut AcceptContext < ' _ , ' sess , S > ) {
149- // For crate-level attributes we emit a specific set of lints to warn
150- // people about accidentally not using them on the crate.
151152 if target == Target :: Crate {
152153 return ;
153154 }
0 commit comments