rust-lang / rust-lang/rust-clippy
`std_instead_of_core`/etc. should emit `MultiLine` help messages
@bushrat011899 is already working on this.
Since Jun 22, 2026.
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
Description
For a multi-import statement, the std_instead_of_core family of lints will either:
- Emit a single suggestion if the root of the import can be replaced with
core/alloc - Emit one help for each member of the import that can be updated.
This can be quite frustrating for larger import statements, since it's not uncommon for only one or two items in the statement to be unavailable from core or alloc. Consider the below:
use std::{
sync::atomic::{Ordering, AtomicBool},
fmt::Debug,
ops::{self, Add},
};
This emits 1 suggestion, replace std with core. However, if I add Mutex to the statement:
use std::{
sync::{
atomic::{Ordering, AtomicBool},
Mutex,
},
fmt::Debug,
ops::{self, Add},
};
This will now produce 5 std_instead_of_core lints, each only showing a small part of the overall statement, when only a single item needs to be moved (Mutex) into it's own std import to allow for the whole original statement to be from core.
If instead a multiline help was emitted, the number of lints emitted stays the same (one), but it changes from a suggestion on std to a help on each applicable item.
#17252 sets up the required changes to how multi-imports are handled to allow for this change. All that would be required is to emit the MultiSpans it computes directly, instead of iterating their primary_spans.
Version
rustc 1.98.0-nightly (485ec3fbc 2026-06-10)
binary: rustc
commit-hash: 485ec3fbcc12fa14ef6596dabb125ad710499c9e
commit-date: 2026-06-10
host: x86_64-pc-windows-msvc
release: 1.98.0-nightly
LLVM version: 22.1.6
Additional Labels
@rustbot label +C-enhancement
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.