Skip to content

Sort derives #4112

Closed
Closed
@Luro02

Description

@Luro02

I always try to keep derives in a certain order, so they are uniform with the rest of the crate. It would be nice if rustfmt could automatically sort them :)

I could imagine sorting them:

  • alphabetically:

    #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
  • after some sort of priority
    I like the order in which the traits are listed in the rust-api-guidelines

    #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Display, Default)]

    I think they simply grouped similar traits together:

    • Copy + Clone
    • Eq + PartialEq
    • Ord + PartialOrd
    • Debug + Display

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions