Remove #[derive(Default)] from custom structs in examples.
Why
The Default trait's usefulness in contracts is limited because SDK types such as Vec, BytesN, etc cannot implement it. Deriving Default on a UDT requires all its field's types to also implement Default. Using it in an example sets developers up for encountering compile errors when they start adding SDK types to the UDT. The Default trait isn't utilized by the example in any way other than deriving it, so the derive is unnecessary.
What
Remove
#[derive(Default)]
from custom structs in examples.Why
The
Default
trait's usefulness in contracts is limited because SDK types such asVec
,BytesN
, etc cannot implement it. DerivingDefault
on a UDT requires all its field's types to also implementDefault
. Using it in an example sets developers up for encountering compile errors when they start adding SDK types to the UDT. TheDefault
trait isn't utilized by the example in any way other than deriving it, so the derive is unnecessary.Thanks @tomerweller for identifying this issue.