Closed
Description
Summary
std_instead_of_core
, std_instead_of_alloc
, alloc_instead_of_core
do not explain which items in a larger nested import can be imported from elsewhere and which cannot, causing impractical warnings.
Reproducer
I tried this code:
use std::{
alloc::{self, Layout},
marker::PhantomData,
ops::Deref,
sync::{
Mutex,
atomic::{AtomicUsize, Ordering},
},
thread::{self, JoinHandle, sleep},
time::Duration,
};
I expected to see this happen:
individual warnings for each item that can come from core
or alloc
Instead, this happened:
warning: used import from `std` instead of `core`
--> src/lib.rs:15:5
|
15 | use std::{
| ^^^ help: consider importing the item from `core`: `core`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#std_instead_of_core
= note: `#[warn(clippy::std_instead_of_core)]` implied by `#[warn(clippy::restriction)]`
warning: used import from `std` instead of `core`
--> src/lib.rs:15:5
|
15 | use std::{
| ^^^ help: consider importing the item from `core`: `core`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#std_instead_of_core
Version
rustc 1.89.0-nightly (d13a431a6 2025-06-09)
binary: rustc
commit-hash: d13a431a6cc69cd65efe7c3eb7808251d6fd7a46
commit-date: 2025-06-09
host: x86_64-unknown-linux-gnu
release: 1.89.0-nightly
LLVM version: 20.1.5
Additional Labels
No response