rust-lang / rust-lang/rust-clippy
`extra_unused_type_parameters` fires with `#![allow(unused)]`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
Summary
extra_unused_type_parameters still fires with #![allow(unused)] or dead_code set. It should probably not fire in these cases.
Lint Name
extra_unused_type_parameters
Reproducer
I tried this code:
#![allow(unused)]
#![warn(clippy::extra_unused_type_parameters)]
fn foo<T: Clone>() {
todo!()
}
I saw this happen:
warning: type parameter `T` goes unused in function definition
--> src/lib.rs:4:7
|
4 | fn foo<T: Clone>() {
| ^^^^^^^^^^ help: consider removing the parameter
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_type_parameters
note: the lint level is defined here
--> src/lib.rs:2:9
|
2 | #![warn(clippy::extra_unused_type_parameters)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I expected to see this happen: No error
Version
Current playground, 1.76.0
Additional Labels
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.
Research direction
Start with the linked Rust Playground reproducer and the extra_unused_type_parameters lint entry point. Confirm the behavior with #![allow(unused)] and dead_code while the Clippy lint is enabled. Done means the lint no longer reports the unused type parameter in those cases, while its existing warning behavior remains covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 42/100