Closed
Description
Lint name: needless_lifetimes
I tried this code:
fn add<'a> (x: &'a u8, _: &u8) -> &'a u8 {x}
async fn async_add<'a> (x: &'a u8, _: &u8) -> &'a u8 {x}
I expected to see this happen:
I don't expect to see any needless_lifetimes
lint errors. In both functions the 'a
lifetime is required to tell the compiler which input the output borrows from.
Instead, this happened:
I receive a needless_lifetimes
error for async_add
. There isn't a way to resolve this line without ignoring the lint rule, since replacing any combination of the lifetime parameters with the anonymous lifetime result in a compiler error.
Meta
cargo clippy -V
:clippy 0.1.52 (9bc8c42b 2021-05-09)
rustc -Vv
:rustc 1.52.1 (9bc8c42bb 2021-05-09) binary: rustc commit-hash: 9bc8c42bb2f19e745a63f3445f1ac248fb015e53 commit-date: 2021-05-09 host: x86_64-apple-darwin release: 1.52.1 LLVM version: 12.0.0