Move `should_emit` check
diff --git a/compiler/rustc_attr_parsing/src/interface.rs b/compiler/rustc_attr_parsing/src/interface.rs
index 2bde4d0..eb49f10 100644
--- a/compiler/rustc_attr_parsing/src/interface.rs
+++ b/compiler/rustc_attr_parsing/src/interface.rs
@@ -412,9 +412,7 @@ pub fn parse_attribute_list(
                         (accept.accept_fn)(&mut cx, &args);
                         finalizers.push(accept.finalizer);
 
-                        if !matches!(cx.should_emit, ShouldEmit::Nothing) {
-                            Self::check_target(&accept.allowed_targets, &mut cx);
-                        }
+                        Self::check_target(&accept.allowed_targets, &mut cx);
                     } else {
                         let attr = AttrItem {
                             path: attr_path.clone(),
diff --git a/compiler/rustc_attr_parsing/src/target_checking.rs b/compiler/rustc_attr_parsing/src/target_checking.rs
index c20faa9..db86504 100644
--- a/compiler/rustc_attr_parsing/src/target_checking.rs
+++ b/compiler/rustc_attr_parsing/src/target_checking.rs
@@ -7,7 +7,6 @@
 use rustc_hir::{AttrItem, Attribute, MethodKind, Target};
 use rustc_span::{BytePos, FileName, RemapPathScopeComponents, Span, Symbol, sym};
 
-use crate::AttributeParser;
 use crate::context::AcceptContext;
 use crate::errors::{
     InvalidAttrAtCrateLevel, InvalidTargetLint, ItemFollowingInnerAttr,
@@ -15,6 +14,7 @@
 };
 use crate::session_diagnostics::InvalidTarget;
 use crate::target_checking::Policy::Allow;
+use crate::{AttributeParser, ShouldEmit};
 
 #[derive(Debug)]
 pub(crate) enum AllowedTargets {
@@ -92,6 +92,10 @@ pub(crate) fn check_target(
         allowed_targets: &AllowedTargets,
         cx: &mut AcceptContext<'_, 'sess>,
     ) {
+        if matches!(cx.should_emit, ShouldEmit::Nothing) {
+            return;
+        }
+
         // For crate-level attributes we emit a specific set of lints to warn
         // people about accidentally not using them on the crate.
         if let &AllowedTargets::AllowList(&[Allow(Target::Crate)]) = allowed_targets {