mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 11:07:42 +00:00
![]() Provide structured suggestion for `impl Default` of type where all fields have defaults ``` error: `Default` impl doesn't use the declared default field values --> $DIR/manual-default-impl-could-be-derived.rs:28:1 | LL | / impl Default for B { LL | | fn default() -> Self { LL | | B { LL | | x: s(), | | --- this field has a default value LL | | y: 0, | | - this field has a default value ... | LL | | } | |_^ | help: to avoid divergence in behavior between `Struct { .. }` and `<Struct as Default>::default()`, derive the `Default` | LL ~ #[derive(Default)] struct B { | ``` Note that above the structured suggestion also includes completely removing the manual `impl`, but the rendering doesn't. |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
messages.ftl |