Open
Description
Requested feature(s):
EDIT: (1) is a duplicate of #4112, which was a duplicate of #1867 - ignore this and focus on #2.
- Use
reorder_derive_items
to haverustfmt
change:
#[derive(PartialEq, Copy, Display, Clone)]
Into:
#[derive(Clone, Copy, Display, PartialEq)]
That is, alphabetically sort the derived types.
- Use
reorder_type_constraints
to haverustfmt
change:
pub fn<T: PartialEq + Copy + Debug + 'static + Clone>foo(...) { ... }
Into:
pub fn<T: 'static + Clone + Copy + Debug + PartialEq>foo(...) { ... }
That is, alphabetically sort the contsraint types (and sort lifetimes before types).
Motivation:
When there are more than 2-3 types in either derive or a constraint, it is tedius and error-prone to manually ensure they all appear in the same order. However it is useful for them to be in a deterministic order as this makes it easier to read a list, and more importantly to see the difference between two lists.
Options
Perhaps "standard" traits should be sorted before all other traits?