Open
Description
Code
use std::convert::TryFrom;
pub trait Foo<T>: TryFrom<T> {}
Current output
Compiling playground v0.0.1 (/playground)
warning: the item `TryFrom` is imported redundantly
--> src/lib.rs:1:5
|
1 | use std::convert::TryFrom;
| ^^^^^^^^^^^^^^^^^^^^^
|
::: /playground/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/prelude/mod.rs:129:13
|
129 | pub use core::prelude::rust_2021::*;
| ------------------------ the item `TryFrom` is already defined here
|
= note: `#[warn(unused_imports)]` on by default
Desired output
Compiling playground v0.0.1 (/playground)
warning: the item `TryFrom` is imported redundantly
--> src/lib.rs:1:5
|
1 | use std::convert::TryFrom;
| ^^^^^^^^^^^^^^^^^^^^^
|
= note: `TryFrom` is imported in the 2021 edition prelude
= note: `#[warn(unused_imports)]` on by default
Rationale and extra context
The pub use core::prelude::rust_2021::*;
import is a compiler detail. The user did not write that line so it's confusing to display it to them.
Other cases
No response
Rust Version
rustc 1.78.0-nightly (2bf78d12d 2024-02-18)
binary: rustc
commit-hash: 2bf78d12d33ae02d10010309a0d85dd04e7cff72
commit-date: 2024-02-18
host: x86_64-unknown-linux-gnu
release: 1.78.0-nightly
LLVM version: 18.1.0