Replace many manual trait impls with use of educe
Addresses #366 (closed).
- Replace many open-coded
Debug
impls with use ofeduce
. Fields that ought not to be (or cannot be) dumped are skipped with a newskip_fmt
helper function. I did this because (i) it arranges that the field name gets printed; (ii) educe does not have a way to arrange for the finish call to befinish_non_exhaustive
. - Replace two open-coded
Clone
impls. These existed simply because stock#[derive(Clone)]
infers overly-restrictiveClone
bounds on generic parameters. - Replace a number of open-coded
Default
impls for enums, marking the default variant#[educe(Default)]
. I prefer this because it is more declarative, and puts the default information closer to the type. And it is shorter :-).
In general the added code is use
and #[educe(Debug)]
and so on; the removed lines are open-coded impls. See also !374 (merged) which is the part that didn't need educe.