-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unnecessary type repetition in trait bound #3764
Comments
There are theoretically infinte ways to write where bounds. So as a first step just doing unification of This lint should not trigger inside macros (as it doesn't matter there and some macros might get hard to write), so you should use the You can implement the |
I've just done a draft pull request. It's roughly there and builds but doesn't yet work. |
trait bounds lint - repeated types This PR is to tackle #3764 it's still a WIP and doesn't work but this is an initial stab. It builds though I haven't added any tests as I'm not sure where lint tests should go? Unfortunately, it seems id isn't tied to the type itself but I guess where it is in the AST? Looking at https://manishearth.github.io/rust-internals-docs/syntax/ast/struct.Ty.html I can't see any members that would let me tell if a type was repeated in multiple trait bounds. There may be other issues with how I've implemented this so any assistance is appreciated!
trait bounds lint - repeated types This PR is to tackle #3764 it's still a WIP and doesn't work but this is an initial stab. It builds though I haven't added any tests as I'm not sure where lint tests should go? Unfortunately, it seems id isn't tied to the type itself but I guess where it is in the AST? Looking at https://manishearth.github.io/rust-internals-docs/syntax/ast/struct.Ty.html I can't see any members that would let me tell if a type was repeated in multiple trait bounds. There may be other issues with how I've implemented this so any assistance is appreciated! changelog: Add new lint: `type_repetition_in_bounds`
trait bounds lint - repeated types This PR is to tackle #3764 it's still a WIP and doesn't work but this is an initial stab. It builds though I haven't added any tests as I'm not sure where lint tests should go? Unfortunately, it seems id isn't tied to the type itself but I guess where it is in the AST? Looking at https://manishearth.github.io/rust-internals-docs/syntax/ast/struct.Ty.html I can't see any members that would let me tell if a type was repeated in multiple trait bounds. There may be other issues with how I've implemented this so any assistance is appreciated! changelog: Add new lint: `type_repetition_in_bounds`
So I raised this on rust-lang/rust#58471 and it was suggested this is better as a clippy lint so pasting the issue text here for quick reference:
The offer to help with a PR myself still stands, I had a quick check of the lints and didn't spot it.
The text was updated successfully, but these errors were encountered: