rust-lang / rust-lang/rust-clippy
Unused generic parameter
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
I ended up with a weird case of unused generic parameter that was not detected by the compilation (like it usually is) and that clippy didn't saw either. I'm not sure why but I've been able to craft a Minimal Example (or at least, I was not able to remove any part without the compiler to yell at me).
trait Foo {
fn f();
}
struct Bar;
impl<'a> Foo for &'a Bar {
fn f() {
println!("foobar");
}
}
fn my_func<H>()
where
for<'a> &'a H: Foo,
{
println!("Hello, world!");
}
fn main() {
my_func();
}
In the above example, the function my_func has a generic parameter H that is never used and neither the compiler nor clippy is mentioning it.
Looking for other related issues, I've found #877 but the bug has been fixed. And like in #877, it might be a use case for rustc directly, I'm not sure.
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 minimal Rust example in the issue and run it with the reported compiler and Clippy versions, checking whether either reports the unused generic parameter. Compare the behavior with related issue #877, then determine whether the missing diagnostic belongs in rustc or Clippy; done means the example is correctly diagnosed with an appropriate regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100