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

fix: eliminate needless lifetimes #501

Merged
merged 1 commit into from
Nov 30, 2024

Conversation

chenrui333
Copy link
Contributor

seeing some regression build issue against rust 1.83.0 as

  error: elided lifetime has a name
    --> src/error.rs:37:39
     |
  37 |     fn source<'a>(&'a self) -> Option<&(dyn error::Error + 'static)> {
     |               --                      ^ this elided lifetime gets resolved as `'a`
     |               |
     |               lifetime `'a` declared here
     |
     = note: `-D elided-named-lifetimes` implied by `-D warnings`
     = help: to override `-D warnings` add `#[allow(elided_named_lifetimes)]`

Status: Ready

relates to Homebrew/homebrew-core#199379

Signed-off-by: Rui Chen <rui@chenrui.dev>
@stepchowfun
Copy link
Owner

Thank you! I'm not sure why the CI (which has already been updated to use Rust 1.83.0) didn't catch this.

@stepchowfun stepchowfun merged commit ba63e91 into stepchowfun:main Nov 30, 2024
6 checks passed
@stepchowfun
Copy link
Owner

Oh I think I understand why the CI didn't catch this. The CI did catch it in #499, and I had fixed it in a different way by adding the elided lifetime:

fn source<'a>(&'a self) -> Option<&'a (dyn error::Error + 'static)> {

But this fix in this PR (not explicitly quantifying over the lifetime in the first place) is better:

fn source(&self) -> Option<&(dyn error::Error + 'static)> {

So, I think this PR is technically unnecessary; the build should already be passing on the latest commit before this PR. But I think this PR makes the code slightly better!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants