Skip to content

lint suggestion: needless_lifetimes in impl<'a> #12424

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

Closed
thetayloredman opened this issue Mar 5, 2024 · 3 comments
Closed

lint suggestion: needless_lifetimes in impl<'a> #12424

thetayloredman opened this issue Mar 5, 2024 · 3 comments
Assignees
Labels
A-lint Area: New lints

Comments

@thetayloredman
Copy link

thetayloredman commented Mar 5, 2024

What it does

needless_lifetimes currently could support suggesting lifetime elison in impl<'a> T<'a> or impl<'a> Trait for T<'a> signatures.

Advantage

Adds extra verbosity which is not necessary. If we elide lifetimes everywhere else, why don't we suggest it here?

Drawbacks

Unsure if there is any.

Example

impl<'a> MyType<'a> {
    // method definitions that don't reference 'a
}

Could be written as:

impl MyType<'_> {
    // method definitions that don't reference 'a
}
@thetayloredman thetayloredman added the A-lint Area: New lints label Mar 5, 2024
@PartiallyUntyped
Copy link
Contributor

Given that I am in the process of cleaning up needless_lifetimes, I will pick this up.

@rustbot claim

@y21
Copy link
Member

y21 commented Oct 4, 2024

This was implemented in #13286

@y21 y21 closed this as completed Oct 4, 2024
@joshka
Copy link

joshka commented Nov 29, 2024

I think this was missed from the changelog

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants