default()
outside Default
trait RS-E1022Implementing the default()
method outside of the Default
trait is non-idiomatic.
It also makes deriving Default
on any subsequent types using this type impossible,
despite the presence of an implementation for default()
.
Implement the Default
trait for the given type instead.
impl Foo {
fn default() -> Self {
Self {
// ...
}
}
}
impl Default for Foo {
fn default() -> Self {
Self {
// ...
}
}
}