Add a lint for unused type parameters#26684
Conversation
|
(rust_highfive has picked a reviewer for you, use r? to override) |
There was a problem hiding this comment.
It seems weird that this is necessary? Where are things unused?
There was a problem hiding this comment.
One example is core::intrinsics::size_of<T>.
There was a problem hiding this comment.
Oh, hm. Shouldn't extern fns with type params consider them used? (But, in general, it makes sense that there may be a few things like that.)
|
It looks like there's a number of legitimate use cases for having "unused" parameters, so can this be an allow-by-default lint instead of warn-by-default? |
|
The reason this is a lint (and not a hard error, unlike |
|
I understand my viewpoint on whether lints should be warn by default is subject, by my believe is that any false positive on a lint means that it should not be warn-by-default. I've found that over time projects end up gaining dozens of little |
|
This is not the first time you argued for allow-by-default. In #10477 you wrote:
But dead_code lint was accepted warn-by-default. I am curious what changed your mind, because like @huonw on that thread, I think this should be warn-by-default. |
I agree! I have historically been very anti-lints as I feel we have far too many already and generate too many warnings for false positives.
Right, but that was almost two years ago. I would want it to be allow-by-default today. |
|
This is an interesting discussion. I wonder if we should adopt the convention that you can write |
|
☔ The latest upstream changes (presumably #27818) made this pull request unmergeable. Please resolve the merge conflicts. |
|
Closing due to inactivity, but feel free to resubmit with a rebase! |
Fix #25871.