Skip to content

Commit 63e9678

Browse files
committed
docs: fix import order convention to match cargo fmt
cargo fmt sorts external crate and std imports alphabetically together — it does not enforce a separate "external before std" grouping. Update CONTRIBUTING.md and CLAUDE.md to reflect the actual tooling behavior. https://claude.ai/code/session_01MHKaZm6DcA9kjBPnW3KN5K
1 parent 97c3736 commit 63e9678

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Read and follow the CONTRIBUTING.md file in this repository for all code style c
66

77
- Commit format: Conventional Commits — `type(scope): lowercase description`
88
- Version releases are the only exception: just the version number (e.g. `0.21.1`)
9-
- Import order: internal (`crate::`/`super::`) external crates `std::`, prefer merged imports
9+
- Import order: internal (`crate::`/`super::`) first, then external crates and `std::` together (alphabetical, enforced by `cargo fmt`), prefer merged imports
1010
- Use descriptive generic names (`Size`, `Report`), not single letters
1111
- Prefer `where` clauses for multiple trait bounds
1212
- Derive order: std traits → comparison traits → `Hash` → derive_more → feature-gated

CONTRIBUTING.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,9 @@ Prefer **merged imports** — combine multiple items from the same crate or modu
3737
Imports are grouped in this order, separated by blank lines:
3838

3939
1. `use super::...` or `use crate::...` (internal)
40-
2. External crate imports (alphabetical)
41-
3. `use std::...` (standard library)
40+
2. All other imports — external crates and `std::` together, sorted alphabetically
4241

43-
Within each group, items are ordered alphabetically. Platform-specific imports (`#[cfg(unix)]`) go in a separate block after the main imports.
42+
`cargo fmt` enforces alphabetical ordering across external and `std` imports (it does not distinguish between them). Platform-specific imports (`#[cfg(unix)]`) go in a separate block after the main imports.
4443

4544
```rust
4645
use crate::{

0 commit comments

Comments
 (0)