-
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
Separate lint needless_lifetimes for types with multiple lifetimes #12495
Comments
@rustbot claim |
@antoyo instead of providing a separate lint, I would like to introduce a configuration in this lint, allowing you to toggle this functionality as follows:
|
I didn't know lints could be configured.
Not sure if this going to be a problem. |
Yes, that. We discussed this a bit on zulip and the consensus is that this lint and suggestion are good candidates for this. |
I'm good with this. |
What it does
I'd like to propose to make the lint
needless_lifetimes
only warn for references (and possibly types with a single lifetime) and add a new separate lint likeneedless_lifetimes
, but that warns for types with multiple lifetimes (where at least one could be elided).An alternative could to be not warn about
needless_lifetimes
when the lifetimes contain multiple characters (like'stuff
).Advantage
For types with multiple lifetimes, it might help readability to keep the lifetimes in the code even if they could be elided.
So, by having a new separate lint, users who prefer to keep lifetimes on types with multiple lifetimes, they could disable this new lint and keep the ability to get warned about
needless_lifetimes
for simple cases.Drawbacks
None since the choice would be up to the user.
Example
Could be written as:
The text was updated successfully, but these errors were encountered: