-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Closed
Labels
C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.I-compiletimeIssue: Problems and improvements with respect to compile times.Issue: Problems and improvements with respect to compile times.
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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.I-compiletimeIssue: Problems and improvements with respect to compile times.Issue: Problems and improvements with respect to compile times.
Type
Fields
Give feedbackNo fields configured for issues without a type.