-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
A-lintArea: New lintsArea: New lints
Description
What it does
Detects custom std::default::Default
implementations that are identical to a derived implementation. This could probably be done with other derive attributes, but I think Default
is a fairly common one that people may implement themselves.
Categories (optional)
- Kind:
clippy::style
What is the advantage of the recommended code over the original code
It is more concise.
Drawbacks
I have no clue about the internals of Clippy, so I'm not sure how hard it would be to implement.
Example
struct Foo {
bar: bool
}
impl std::default::Default for Foo {
fn default() -> Self {
Self {
bar: false
}
}
}
Could be written as:
#[derive(Default)]
struct Foo {
bar: bool
}
Metadata
Metadata
Assignees
Labels
A-lintArea: New lintsArea: New lints