@@ -414,8 +414,6 @@ pub struct Attributes {
414414}
415415
416416impl_lint_pass ! ( Attributes => [
417- ALLOW_ATTRIBUTES ,
418- ALLOW_ATTRIBUTES_WITHOUT_REASON ,
419417 INLINE_ALWAYS ,
420418 DEPRECATED_SEMVER ,
421419 USELESS_ATTRIBUTE ,
@@ -445,13 +443,6 @@ impl<'tcx> LateLintPass<'tcx> for Attributes {
445443 if is_lint_level ( ident. name , attr. id ) {
446444 blanket_clippy_restriction_lints:: check ( cx, ident. name , items) ;
447445 }
448- if matches ! ( ident. name, sym:: allow) && self . msrv . meets ( msrvs:: LINT_REASONS_STABILIZATION ) {
449- allow_attributes:: check ( cx, attr) ;
450- }
451- if matches ! ( ident. name, sym:: allow | sym:: expect) && self . msrv . meets ( msrvs:: LINT_REASONS_STABILIZATION )
452- {
453- allow_attributes_without_reason:: check ( cx, ident. name , items, attr) ;
454- }
455446 if items. is_empty ( ) || !attr. has_name ( sym:: deprecated) {
456447 return ;
457448 }
@@ -526,3 +517,38 @@ impl EarlyLintPass for EarlyAttributes {
526517
527518 extract_msrv_attr ! ( EarlyContext ) ;
528519}
520+
521+ pub struct PostExpansionEarlyAttributes {
522+ msrv : Msrv ,
523+ }
524+
525+ impl PostExpansionEarlyAttributes {
526+ pub fn new ( conf : & ' static Conf ) -> Self {
527+ Self {
528+ msrv : conf. msrv . clone ( ) ,
529+ }
530+ }
531+ }
532+
533+ impl_lint_pass ! ( PostExpansionEarlyAttributes => [
534+ ALLOW_ATTRIBUTES ,
535+ ALLOW_ATTRIBUTES_WITHOUT_REASON ,
536+ ] ) ;
537+
538+ impl EarlyLintPass for PostExpansionEarlyAttributes {
539+ fn check_attribute ( & mut self , cx : & EarlyContext < ' _ > , attr : & Attribute ) {
540+ if let Some ( items) = & attr. meta_item_list ( ) {
541+ if let Some ( ident) = attr. ident ( ) {
542+ if matches ! ( ident. name, sym:: allow) && self . msrv . meets ( msrvs:: LINT_REASONS_STABILIZATION ) {
543+ allow_attributes:: check ( cx, attr) ;
544+ }
545+ if matches ! ( ident. name, sym:: allow | sym:: expect) && self . msrv . meets ( msrvs:: LINT_REASONS_STABILIZATION )
546+ {
547+ allow_attributes_without_reason:: check ( cx, ident. name , items, attr) ;
548+ }
549+ }
550+ }
551+ }
552+
553+ extract_msrv_attr ! ( EarlyContext ) ;
554+ }
0 commit comments