Skip to content

Commit 5936964

Browse files
committed
Attribute and doc comment ordering
Closes #72
1 parent 2c5de5d commit 5936964

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

guide/guide.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ Prefer line comments (`///`) to block comments (`//* ... */`).
8181
Prefer outer doc comments (`///` or `//*`), only use inner doc comments (`//!`
8282
and `//*!`) to write module-level or crate-level documentation.
8383

84+
Doc comments should come before attributes.
8485

8586
### Attributes
8687

@@ -100,6 +101,11 @@ struct CRepr {
100101
}
101102
```
102103

104+
There must only be a single `derive` attribute. Note for tool authors: if
105+
combining multiple `derive` attributes into a single attribute, the ordering of
106+
the derived names should be preserved. E.g., `#[derive(bar)] #[derive(foo)]
107+
struct Baz;` should be formatted to `#[derive(bar, foo)] struct Baz;`.
108+
103109
## [Non-formatting conventions](advice.md)
104110

105111
## [Cargo.toml conventions](cargo.md)

0 commit comments

Comments
 (0)