about summary refs log tree commit diff
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
commit4328c95899b553d61f83301d77f12d037b2deecd (patch)
tree7c51d6ec2c9478149643758c682b208292bdf9b7
parentba107fcffba2aefc83e199286a5ccdbb29f69d5d (diff)
parent32722771ec2735038567545bad598d45291759a2 (diff)
downloadrust-4328c95899b553d61f83301d77f12d037b2deecd.tar.gz
rust-4328c95899b553d61f83301d77f12d037b2deecd.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
-rw-r--r--clippy_utils/src/lib.rs10
1 files changed, 2 insertions, 8 deletions
diff --git a/clippy_utils/src/lib.rs b/clippy_utils/src/lib.rs
index 14b64eb4d54..e1077bdf4b1 100644
--- a/clippy_utils/src/lib.rs
+++ b/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.