Skip to content

Rust 1.81 and later support elision with explicit self types #13992

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

Merged
merged 1 commit into from
Jan 14, 2025

Conversation

samueltardieu
Copy link
Contributor

Commit 9ef6e21 introduced a check to ensure that Clippy doesn't consider a lifetime present in an explicit self types as being the default for an elided output lifetime. For example, elision did not work in the case like:

  fn func(self: &Rc<Self>, &str) -> &str {}

Since Rust 1.81.0, the lifetime in the self type is now considered the default for elision. Elision should then be suggested when appropriate.

changelog: [needless_lifetimes]: suggest elision of lifetimes present in explicit self types as well

r? @Alexendoo
because of #8278

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jan 13, 2025
Commit 9ef6e21 introduced a check to
ensure that Clippy doesn't consider a lifetime present in an explicit
self type as being the default for an elided output lifetime. For
example, elision did not work in the case like:

```rust
  fn func(self: &Rc<Self>, &str) -> &str { … }
```

Since Rust 1.81.0, the lifetime in the self type is now considered
the default for elision. Elision should then be suggested when
appropriate.
Copy link
Member

@Alexendoo Alexendoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@Alexendoo Alexendoo added this pull request to the merge queue Jan 14, 2025
Merged via the queue into rust-lang:master with commit 98761e4 Jan 14, 2025
11 checks passed
@samueltardieu samueltardieu deleted the push-xqstlqqyrkny branch January 14, 2025 22:58
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.

3 participants