From 3a77db0e3a4aedf33f9e77a3b246100bcb7356e1 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sun, 18 Feb 2024 21:18:19 -0800 Subject: [PATCH] Work around prelude redundant import warnings https://github.com/rust-lang/rust/pull/117772 warning: the item `Box` is imported redundantly --> src/any.rs:1:5 | 1 | use alloc::boxed::Box; | ^^^^^^^^^^^^^^^^^ | ::: nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/prelude/mod.rs:125:13 | 125 | pub use super::v1::*; | --------- the item `Box` is already defined here | = note: `#[warn(unused_imports)]` on by default warning: the item `Box` is imported redundantly --> src/de.rs:5:5 | 5 | use alloc::boxed::Box; | ^^^^^^^^^^^^^^^^^ | ::: nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/prelude/mod.rs:125:13 | 125 | pub use super::v1::*; | --------- the item `Box` is already defined here warning: the item `String` is imported redundantly --> src/de.rs:7:5 | 7 | use alloc::string::String; | ^^^^^^^^^^^^^^^^^^^^^ | ::: nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/prelude/mod.rs:125:13 | 125 | pub use super::v1::*; | --------- the item `String` is already defined here warning: the item `Vec` is imported redundantly --> src/de.rs:9:5 | 9 | use alloc::vec::Vec; | ^^^^^^^^^^^^^^^ | ::: nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/prelude/mod.rs:125:13 | 125 | pub use super::v1::*; | --------- the item `Vec` is already defined here warning: the item `ToOwned` is imported redundantly --> src/error.rs:1:5 | 1 | use alloc::borrow::ToOwned; | ^^^^^^^^^^^^^^^^^^^^^^ | ::: nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/prelude/mod.rs:125:13 | 125 | pub use super::v1::*; | --------- the item `ToOwned` is already defined here warning: the item `Box` is imported redundantly --> src/error.rs:2:5 | 2 | use alloc::boxed::Box; | ^^^^^^^^^^^^^^^^^ | ::: nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/prelude/mod.rs:125:13 | 125 | pub use super::v1::*; | --------- the item `Box` is already defined here warning: the item `String` is imported redundantly --> src/error.rs:3:21 | 3 | use alloc::string::{String, ToString}; | ^^^^^^ | ::: nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/prelude/mod.rs:125:13 | 125 | pub use super::v1::*; | --------- the item `String` is already defined here warning: the item `ToString` is imported redundantly --> src/error.rs:3:29 | 3 | use alloc::string::{String, ToString}; | ^^^^^^^^ | ::: nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/prelude/mod.rs:125:13 | 125 | pub use super::v1::*; | --------- the item `ToString` is already defined here warning: the item `Vec` is imported redundantly --> src/error.rs:4:5 | 4 | use alloc::vec::Vec; | ^^^^^^^^^^^^^^^ | ::: nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/prelude/mod.rs:125:13 | 125 | pub use super::v1::*; | --------- the item `Vec` is already defined here warning: the item `Box` is imported redundantly --> src/ser.rs:4:5 | 4 | use alloc::boxed::Box; | ^^^^^^^^^^^^^^^^^ | ::: nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/prelude/mod.rs:125:13 | 125 | pub use super::v1::*; | --------- the item `Box` is already defined here warning: the item `String` is imported redundantly --> src/ser.rs:5:21 | 5 | use alloc::string::{String, ToString}; | ^^^^^^ | ::: nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/prelude/mod.rs:125:13 | 125 | pub use super::v1::*; | --------- the item `String` is already defined here warning: the item `ToString` is imported redundantly --> src/ser.rs:5:29 | 5 | use alloc::string::{String, ToString}; | ^^^^^^^^ | ::: nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/prelude/mod.rs:125:13 | 125 | pub use super::v1::*; | --------- the item `ToString` is already defined here --- src/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 289506e..53648f6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -96,7 +96,7 @@ //! ``` #![doc(html_root_url = "https://docs.rs/erased-serde/0.4.2")] -#![cfg_attr(not(feature = "std"), no_std)] +#![no_std] #![deny(unsafe_op_in_unsafe_fn)] #![allow( clippy::box_collection, @@ -117,6 +117,9 @@ extern crate alloc; +#[cfg(feature = "std")] +extern crate std; + #[macro_use] mod macros;