Skip to content

Add reorder_attributes config to sort doc attributes before other attributes #3303

@dtolnay

Description

@dtolnay

This was discussed in rust-lang/style-team#72 with the conclusion that the style guide recommends doc comments before attributes, with an option in rustfmt to do the reordering that is off by default.

I did not find an existing option that does this, nor an issue to track, so here we go. :)

Expected diff:

- #[cfg(cfg)]
  /// doc
+ #[cfg(cfg)]
  struct S;

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-commentsArea: commentsC-feature-requestCategory: a feature request (not decided/implemented)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions