Closed
Description
It seems deriving Default
on struct with generic type and lifetime restriction will cause it.
In this example, clippy 0.0.171 suggests me to add #[derive(Default)]
again.
#[derive(Default)]
pub struct S<'a, T: 'a>(Option<&'a T>);
// Manually impl (remove `#[derive(Default)]`) works as expected.
// impl<'a, T: 'a> Default for S<'a, T> {
// fn default() -> Self {
// S::new()
// }
// }
impl<'a, T: 'a> S<'a, T> {
pub fn new() -> Self {
S(None)
}
}
fn main() {
let _ = S::<i32>::default(); // works
}