You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Configure the rule for `prefix_then_alphabetical` with an explicit
`prefix` that encodes the project's preferred derive families in
order: standard, comparison, `Hash`, formatting / error,
conversions, reference wrappers, iteration, arithmetic operator
pairs and folds, and integer-format derives. Anything not in the
prefix (`Setters`, `SmartDefault`, `Parser`, …) falls in ASCII-
case-insensitive alphabetical order after, matching the existing
convention.
Reorder 18 derive lists across the codebase to satisfy the rule.
Every case had derive-more-style traits mixed into the standard-
trait block, contradicting the convention CONTRIBUTING.md already
documents; the rule's suggestions match that documented intent.
Document the rule in `CONTRIBUTING.md`'s derive-ordering section,
and drop the now-redundant within-line ordering bullet from the
shared AI-instructions template (the rule enforces it). The
line-splitting convention (separate `#[cfg_attr(...)]` line for
feature-gated derives) is not enforced by the rule and stays in
the contributing guide as a manual style preference.
https://claude.ai/code/session_01CoRidYHvni9nKNgxMPXmfQ
Copy file name to clipboardExpand all lines: .github/copilot-instructions.md
-1Lines changed: 0 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,6 @@ Read and follow the CONTRIBUTING.md file in this repository for all code style c
12
12
- Use descriptive names for variables and closure parameters. Single letters are permitted only in these cases: (1) conventional names like `n` for count or `f` for formatter; (2) comparison closures like `|a, b|`; (3) trivial single-expression closures; (4) fold accumulators; (5) index variables `i`/`j`/`k` in short closures or index-based loops; and (6) test fixtures with identical roles. Single letters are never permitted in multi-line functions or closures.
13
13
- Use `pipe-trait` to chain through unary functions such as constructors, `Some`, `Ok`, and free functions. Use it to flatten nested calls and to continue method chains. Do not use it for simple standalone calls; prefer `foo(value)` over `value.pipe(foo)`.
14
14
- Prefer `where` clauses when a type has multiple trait bounds.
15
-
- Derive order: standard traits, then comparison traits, then `Hash`, then `derive_more`, then feature-gated derives.
16
15
- For error types, only derive `Display` and `Error` from `derive_more` when each is actually needed. Not all displayable types are errors.
17
16
- Minimize `unwrap()` in non-test code. Use proper error handling instead.
18
17
- Prefer `#[cfg_attr(..., ignore = "reason")]` over `#[cfg(...)]` when skipping tests. Use `#[cfg]` on tests only when the code cannot compile under the condition, such as when it references types or functions that do not exist on other platforms.
Copy file name to clipboardExpand all lines: AGENTS.md
-1Lines changed: 0 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,6 @@ Read and follow the CONTRIBUTING.md file in this repository for all code style c
12
12
- Use descriptive names for variables and closure parameters. Single letters are permitted only in these cases: (1) conventional names like `n` for count or `f` for formatter; (2) comparison closures like `|a, b|`; (3) trivial single-expression closures; (4) fold accumulators; (5) index variables `i`/`j`/`k` in short closures or index-based loops; and (6) test fixtures with identical roles. Single letters are never permitted in multi-line functions or closures.
13
13
- Use `pipe-trait` to chain through unary functions such as constructors, `Some`, `Ok`, and free functions. Use it to flatten nested calls and to continue method chains. Do not use it for simple standalone calls; prefer `foo(value)` over `value.pipe(foo)`.
14
14
- Prefer `where` clauses when a type has multiple trait bounds.
15
-
- Derive order: standard traits, then comparison traits, then `Hash`, then `derive_more`, then feature-gated derives.
16
15
- For error types, only derive `Display` and `Error` from `derive_more` when each is actually needed. Not all displayable types are errors.
17
16
- Minimize `unwrap()` in non-test code. Use proper error handling instead.
18
17
- Prefer `#[cfg_attr(..., ignore = "reason")]` over `#[cfg(...)]` when skipping tests. Use `#[cfg]` on tests only when the code cannot compile under the condition, such as when it references types or functions that do not exist on other platforms.
Copy file name to clipboardExpand all lines: CLAUDE.md
-1Lines changed: 0 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,6 @@ Read and follow the CONTRIBUTING.md file in this repository for all code style c
12
12
- Use descriptive names for variables and closure parameters. Single letters are permitted only in these cases: (1) conventional names like `n` for count or `f` for formatter; (2) comparison closures like `|a, b|`; (3) trivial single-expression closures; (4) fold accumulators; (5) index variables `i`/`j`/`k` in short closures or index-based loops; and (6) test fixtures with identical roles. Single letters are never permitted in multi-line functions or closures.
13
13
- Use `pipe-trait` to chain through unary functions such as constructors, `Some`, `Ok`, and free functions. Use it to flatten nested calls and to continue method chains. Do not use it for simple standalone calls; prefer `foo(value)` over `value.pipe(foo)`.
14
14
- Prefer `where` clauses when a type has multiple trait bounds.
15
-
- Derive order: standard traits, then comparison traits, then `Hash`, then `derive_more`, then feature-gated derives.
16
15
- For error types, only derive `Display` and `Error` from `derive_more` when each is actually needed. Not all displayable types are errors.
17
16
- Minimize `unwrap()` in non-test code. Use proper error handling instead.
18
17
- Prefer `#[cfg_attr(..., ignore = "reason")]` over `#[cfg(...)]` when skipping tests. Use `#[cfg]` on tests only when the code cannot compile under the condition, such as when it references types or functions that do not exist on other platforms.
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+2-6Lines changed: 2 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -71,13 +71,9 @@ pub use event::Event;
71
71
72
72
### Derive Macro Ordering
73
73
74
-
When deriving multiple traits, use this order and split across multiple `#[derive(...)]`lines for readability:
74
+
The order of trait names within each `#[derive(...)]`attribute is enforced automatically by the `perfectionist::derive_ordering` rule, configured for the `prefix_then_alphabetical` style. The configured `prefix` in `dylint.toml` lists the trait families in their project-preferred order: standard traits, then comparison traits, then `Hash`, then formatting / error derives, then conversions, then reference wrappers, then iteration, then arithmetic operator pairs and folds, then integer-format derives. Any trait that is not in the `prefix` (project-specific derives such as `Setters`, `SmartDefault`, and `Parser`) falls in ASCII-case-insensitive alphabetical order after the prefix entries.
4.**`derive_more` traits:**`Display`, `From`, `Into`, `Add`, `AddAssign`, etc.
80
-
5.**Feature-gated derives** on a separate `#[cfg_attr(...)]` line
76
+
The remaining conventions are not enforced by the rule and must be applied by hand. When a type derives many traits, split them across multiple `#[derive(...)]` lines for readability, and place feature-gated derives on a separate `#[cfg_attr(...)]` line.
0 commit comments