4 releases
| 0.2.1 | Feb 7, 2026 |
|---|---|
| 0.1.3 | Dec 23, 2018 |
| 0.1.1 | Dec 20, 2018 |
| 0.1.0 | Dec 20, 2018 |
#188 in Cargo plugins
930 downloads per month
21KB
490 lines
cargo-tomlfmt
Formatting Cargo.toml.
Installation
cargo install cargo-tomlfmt
Usage
cargo tomlfmt
Behavior
- Formats all top-level tables, including
[package]. - In
[features], keepsdefaultfirst and sorts the rest alphabetically. - In
[workspace], formatsmembersas a multi-line array for readability. - When run on a workspace root manifest, also formats each member's
Cargo.toml.
Options
> cargo tomlfmt
FLAGS:
-c, --create Create a formatted manifest as Cargo.toml.new when dryrun.
-d, --dryrun Do NOT overwrite the file.
-h, --help Prints help information
-k, --keep Keep the original manifest as Cargo.toml.bak.
-p, --path Path of the manifest. (default is Cargo.toml)
-V, --version Prints version information
When formatting a workspace root, the same .bak / .new behavior applies
to each member manifest.
Configuration
If a tomlfmt.toml file exists next to the manifest, it will be loaded to
control formatting behavior.
Example:
sort_keys = false
You can also nest options under a [tomlfmt] table:
[tomlfmt]
sort_keys = false
Dependencies
~2.5MB
~41K SLoC