From 18fe0e1905fc69cd2eb44a5f72a08391737016e6 Mon Sep 17 00:00:00 2001 From: Aleksei Bavshin Date: Tue, 7 Jan 2025 13:30:36 -0800 Subject: [PATCH] fix: avoid implicit import of `std::prelude` Conditional `cfg_attr` on `no_std` has an unforeseen consequence: implicit import of `std::prelude` in the default configuration. That makes it harder to notice if we accidentally use any `std` types available from the prelude. --- src/lib.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 906af2a..8c5be72 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -32,11 +32,13 @@ //! # now you can use dynamic modules with the NGINX //! ``` -// support both std and no_std -#![cfg_attr(not(feature = "std"), no_std)] #![warn(missing_docs)] +// support both std and no_std +#![no_std] #[cfg(all(not(feature = "std"), feature = "alloc"))] extern crate alloc; +#[cfg(feature = "std")] +extern crate std; /// The core module. ///