Lint unused assoc types although the trait is used
Open
@mu001999 is already working on this.
Since Jul 13, 2024.
A-associated-items
A-lints
C-bug
L-dead_code
T-compiler
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Code
trait Tr {
type X;
}
impl Tr for () {
type X = Self;
}
fn foo() -> impl Tr {}
fn main() {
foo();
}
Current output
No warning.
Desired output
warning: associated type `X` is never used
--> src/main.rs:2:11
|
1 | trait Tr {
| -- associated type in this trait
2 | type X;
| ^
|
= note: `#[warn(dead_code)]` on by default
Rationale and extra context
No response
Other cases
No response
Rust Version
Build using the Nightly version: 1.81.0-nightly
(2024-07-12 c6727fc9b5c64cefa726)
Anything else?
No response
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.