| Crates.io | cargo-derivefmt-core |
| lib.rs | cargo-derivefmt-core |
| version | 0.1.0 |
| created_at | 2025-12-20 06:36:40.235964+00 |
| updated_at | 2025-12-20 06:36:40.235964+00 |
| description | Core derivefmt functionality |
| homepage | |
| repository | https://github.com/dcchut/derivefmt |
| max_upload_size | |
| id | 1996076 |
| size | 58,514 |
A tool for ordering derives in Rust code.
cargo-derivefmt ensures that your derives are written in alphabetical order.
// Before: pure chaos.
#[derive(Debug, PartialEq, Ord, Clone, Copy)]
struct S;
// After: blissful order.
#[derive(Clone, Copy, Debug, Ord, PartialEq)]
struct S;
That's it! That's all this does.
This package is currently implemented using rust-analyzer internals, so cannot be published on crates.io.
cargo install --locked --git https://github.com/dcchut/cargo-derivefmt --bin cargo-derivefmt
cargo derivefmt
cargo derivefmt --manifest-path /path/to/Cargo.toml
cargo derivefmt --file path/to/src.rs
cargo derivefmt --file path/to/src.rs --file /path/to/another.rs
Passing a folder formats all .rs files contained within it and its subfolders:
cargo derivefmt --file /path/to/folder/