about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorJana Dönszelmann <jonathan@donsz.nl>2025-09-13 02:40:44 +0200
committerGitHub <noreply@github.com>2025-09-13 02:40:44 +0200
commit147e97ae68b224f3980ad818b29738c0bc7e4d88 (patch)
tree4a828ffb59e88d2b189ed4638d4e8debb22a4bf1 /src
parent4ba1cf9ade4c8e2fa10676a50ee34594eb161837 (diff)
parentdbd3ef1332574ef074c147f3b9e3e74dd29cd7b5 (diff)
downloadrust-147e97ae68b224f3980ad818b29738c0bc7e4d88.tar.gz
rust-147e97ae68b224f3980ad818b29738c0bc7e4d88.zip
Rollup merge of #146389 - jdonszelmann:no-std, r=oli-obk
Convert `no_std` and `no_core` to the new attribute infrastructure

r? ```@oli-obk```

Also added a test for these, since we didn't have any and I was kind of surprised new diagnostics didn't break anything hehe
Diffstat (limited to 'src')
-rw-r--r--src/tools/clippy/clippy_utils/src/lib.rs10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/tools/clippy/clippy_utils/src/lib.rs b/src/tools/clippy/clippy_utils/src/lib.rs
index 14b64eb4d54..e1077bdf4b1 100644
--- a/src/tools/clippy/clippy_utils/src/lib.rs
+++ b/src/tools/clippy/clippy_utils/src/lib.rs
@@ -2133,17 +2133,11 @@ pub fn std_or_core(cx: &LateContext<'_>) -> Option<&'static str> {
 }
 
 pub fn is_no_std_crate(cx: &LateContext<'_>) -> bool {
-    cx.tcx
-        .hir_attrs(hir::CRATE_HIR_ID)
-        .iter()
-        .any(|attr| attr.has_name(sym::no_std))
+    find_attr!(cx.tcx.hir_attrs(hir::CRATE_HIR_ID), AttributeKind::NoStd(..))
 }
 
 pub fn is_no_core_crate(cx: &LateContext<'_>) -> bool {
-    cx.tcx
-        .hir_attrs(hir::CRATE_HIR_ID)
-        .iter()
-        .any(|attr| attr.has_name(sym::no_core))
+    find_attr!(cx.tcx.hir_attrs(hir::CRATE_HIR_ID), AttributeKind::NoCore(..))
 }
 
 /// Check if parent of a hir node is a trait implementation block.