Skip to content

fix: eliminate needless lifetimes#501

Merged
stepchowfun merged 1 commit intostepchowfun:mainfrom
chenrui333:rust-1.83.0
Nov 30, 2024
Merged

fix: eliminate needless lifetimes#501
stepchowfun merged 1 commit intostepchowfun:mainfrom
chenrui333:rust-1.83.0

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
@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!

@leana8959 leana8959 mentioned this pull request May 6, 2025
13 tasks
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