Skip to content
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

Use anonymous lifetime where possible #15169

Merged
merged 1 commit into from Jun 30, 2023

Conversation

lowr
Copy link
Contributor

@lowr lowr commented Jun 29, 2023

Because anonymous lifetimes are super cool.

More seriously, I believe anonymous lifetimes, especially those in impl headers, reduce cognitive load to a certain extent because they usually signify that they are not relevant in the signature of the methods within (or that we can apply the usual lifetime elision rules even if they are relevant).

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 29, 2023
@HKalbasi
Copy link
Member

IIRC there is a clippy lint for that, you can use it to check if any of them missed (in case you already didn't do that).

@lowr
Copy link
Contributor Author

lowr commented Jun 29, 2023

That's what I anticipated, but I couldn't find it. Mind checking it?

@HKalbasi
Copy link
Member

@lowr
Copy link
Contributor Author

lowr commented Jun 30, 2023

So I've rechecked but no lints in https://rust-lang.github.io/rust-clippy/master/#/lifetime got triggered by this code :/ I might as well file an issue for clippy.

struct S<'a>(&'a i32);
impl<'a> S<'a> {}

@HKalbasi
Copy link
Member

It is reported: rust-lang/rust-clippy#10394

So let's merge this.
@bors r+

@bors
Copy link
Collaborator

bors commented Jun 30, 2023

📌 Commit 4e793e7 has been approved by HKalbasi

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Jun 30, 2023

⌛ Testing commit 4e793e7 with merge 76bcd99...

@bors
Copy link
Collaborator

bors commented Jun 30, 2023

☀️ Test successful - checks-actions
Approved by: HKalbasi
Pushing 76bcd99 to master...

@bors bors merged commit 76bcd99 into rust-lang:master Jun 30, 2023
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants