Skip to content

Replace many manual trait impls with use of educe

Ian Jackson requested to merge Diziet/arti:educe-traits into main

Addresses #366 (closed).

  • Replace many open-coded Debug impls with use of educe. Fields that ought not to be (or cannot be) dumped are skipped with a new skip_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 be finish_non_exhaustive.
  • Replace two open-coded Clone impls. These existed simply because stock #[derive(Clone)] infers overly-restrictive Clone 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.

Merge request reports

Loading