Closed
Description
Here are some ideas for generating less code when deriving. All of these break down with generic fields, since then we have to fall back to the current general scheme.
PartialEq
For C-like enums, only produce eq
and not ne
. The default ne calls eq and is always enough. Edit: implemented in #31977.
PartialOrd
For C-like enums only produce partial_cmp
and not the four other methods lt, le, gt, ge. This needs an experiment to see if only partial_cmp
is good enough. Maybe another of the single methods can be enough, too.
PartialOrd, Ord
together
When there are no generic parameters, simply call .cmp()
in .partial_cmp()
.
cc @durka