-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.E-hardCall for participation: Hard difficulty. Experience needed to fix: A lot.Call for participation: Hard difficulty. Experience needed to fix: A lot.
Description
It's easy to accidentally leave an unnecessary (e.g.) Clone
bound when refactoring a function, making the function less generic/useful than it otherwise could be.
This would warn for something like:
// warning: unnecessary trait bound. No method from `Clone` is used.
fn foo<T: Clone>(x: T) -> T {
x
}
It would presumably have to be very careful about super-traits i.e. using a function from a super-trait, but not one from the listed trait bound, would either not warn at all, or suggest that the constraints could be weakened to that trait (handling multiple supertraits would be even trickier, i.e. if a function from 2 different super-traits was called, is it sensible/useful to suggest weakening to a combination of those two traits?)
Presumably a far-future feature, if at all.
Metadata
Metadata
Assignees
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.E-hardCall for participation: Hard difficulty. Experience needed to fix: A lot.Call for participation: Hard difficulty. Experience needed to fix: A lot.