rust-clippy/tests/ui/crashes/needless_lifetimes_impl_trait.fixed

22 lines
318 B
Rust
Raw Normal View History

2023-07-27 11:40:22 +00:00
#![deny(clippy::needless_lifetimes)]
#![allow(dead_code)]
trait Foo {}
struct Bar;
struct Baz<'a> {
bar: &'a Bar,
}
2024-08-18 07:31:03 -04:00
impl Foo for Baz<'_> {}
2023-07-27 11:40:22 +00:00
impl Bar {
fn baz(&self) -> impl Foo + '_ {
//~^ ERROR: the following explicit lifetimes could be elided: 'a
2023-07-27 11:40:22 +00:00
Baz { bar: self }
}
}
fn main() {}