default()
RS-W1111An implementation of default()
where every struct member is initialised
with its default value is equivalent to deriving the Default
trait.
Use #[derive(Default)]
instead.
struct Foo {
bar: i32,
baz: String,
}
impl Default for Foo {
fn default() -> Self {
Self {
bar: i32::default(),
baz: String::default(),
}
}
}
#[derive(Default)]
struct Foo {
bar: i32,
baz: String,
}