clippy::new_without_default_derive triggers and shouldn't #3697
Labels
C-bug
Category: Clippy is not doing the correct thing
E-medium
Call for participation: Medium difficulty level problem and requires some initial experience.
I-false-positive
Issue: The lint was triggered on code it shouldn't have
L-suggestion
Lint: Improving, adding or fixing lint suggestions
Uh oh!
There was an error while loading. Please reload this page.
Hi. After going through most of chapter 17.3, we end up with something like this:
and if we run
cargo clippy
, we get a warning that I believe we shouldn't get:Adding
#[derive(Default)]
to structPub
without further changes is enough for the warning to disappear (which looks like a bug by itself); and if we replace the body offn
new withDefault::default()
, as suggested here, we get a different behavior.(BTW, this warning only triggers if the declarations of both struct
Pub
andfn
new are prefixed withpub
, as in the example above).This might be related with #1579.
The text was updated successfully, but these errors were encountered: