From a5158bf577f692324c1d1ce5c9dbaa1521715861 Mon Sep 17 00:00:00 2001 From: Pedro Fedricci Date: Tue, 7 Jan 2025 17:17:50 -0300 Subject: [PATCH] chore: set no_std with conditional extern std --- src/lib.rs | 14 ++++---------- src/test.rs | 2 ++ 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 1f93ed0..808ec48 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -241,16 +241,7 @@ //! [`RawMutex`]: https://docs.rs/lock_api/latest/lock_api/trait.RawMutex.html //! [`RawMutexFair`]: https://docs.rs/lock_api/latest/lock_api/trait.RawMutexFair.html -#![cfg_attr( - all( - not(feature = "yield"), - not(feature = "thread_local"), - not(feature = "parking"), - not(loom), - not(test) - ), - no_std -)] +#![no_std] #![cfg_attr(docsrs, feature(doc_cfg))] #![allow(clippy::module_name_repetitions)] #![allow(clippy::inline_always)] @@ -258,6 +249,9 @@ #![warn(rust_2024_compatibility)] #![warn(missing_docs)] +#[cfg(any(feature = "yield", feature = "thread_local", feature = "parking", loom, test))] +extern crate std; + #[cfg(feature = "thread_local")] #[macro_use] pub(crate) mod thread_local; diff --git a/src/test.rs b/src/test.rs index b0bd1dc..fdf569e 100644 --- a/src/test.rs +++ b/src/test.rs @@ -227,6 +227,8 @@ pub mod tests { use core::ops::RangeInclusive; use std::fmt::Debug; + use std::format; + use std::string::ToString; use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::mpsc::channel; use std::sync::Arc;