Skip to content

Commit 4328c95

Browse files
authored
Rollup merge of rust-lang#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
2 parents ba107fc + 3272277 commit 4328c95

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

clippy_utils/src/lib.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2133,17 +2133,11 @@ pub fn std_or_core(cx: &LateContext<'_>) -> Option<&'static str> {
21332133
}
21342134

21352135
pub fn is_no_std_crate(cx: &LateContext<'_>) -> bool {
2136-
cx.tcx
2137-
.hir_attrs(hir::CRATE_HIR_ID)
2138-
.iter()
2139-
.any(|attr| attr.has_name(sym::no_std))
2136+
find_attr!(cx.tcx.hir_attrs(hir::CRATE_HIR_ID), AttributeKind::NoStd(..))
21402137
}
21412138

21422139
pub fn is_no_core_crate(cx: &LateContext<'_>) -> bool {
2143-
cx.tcx
2144-
.hir_attrs(hir::CRATE_HIR_ID)
2145-
.iter()
2146-
.any(|attr| attr.has_name(sym::no_core))
2140+
find_attr!(cx.tcx.hir_attrs(hir::CRATE_HIR_ID), AttributeKind::NoCore(..))
21472141
}
21482142

21492143
/// Check if parent of a hir node is a trait implementation block.

0 commit comments

Comments
 (0)