When working with libraries that can or can not be #[no_std], it is common to simply extern crate alloc; and then manually import types like alloc::vec::Vec. In this way everything works regardless of the configuration.
However, the latest versions of the compiler are warning such approach.
warning: the item Vec is imported redundantly
--> foo.rs:96:7
|
96 | use alloc::vec::Vec;
| ^^^^^^^^^^^^^^^
|
::: $HOME/.rustup/toolchains/nightly-2024-02-19-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
In the above example, if use alloc::vec::Vec; is removed #[no_std] breaks. If not removed, the warning persists 😑
Maybe related: #121312 #121331 #121330 #120422
When working with libraries that can or can not be
#[no_std], it is common to simplyextern crate alloc;and then manually import types likealloc::vec::Vec. In this way everything works regardless of the configuration.However, the latest versions of the compiler are warning such approach.
In the above example, if
use alloc::vec::Vec;is removed#[no_std]breaks. If not removed, the warning persists 😑Maybe related: #121312 #121331 #121330 #120422