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

Download history 144/week @ 2025-12-03 92/week @ 2025-12-10 97/week @ 2025-12-17 116/week @ 2025-12-24 210/week @ 2025-12-31 152/week @ 2026-01-07 347/week @ 2026-01-14 255/week @ 2026-01-21 200/week @ 2026-01-28 298/week @ 2026-02-04 141/week @ 2026-02-11 135/week @ 2026-02-18 242/week @ 2026-02-25 172/week @ 2026-03-04 306/week @ 2026-03-11 184/week @ 2026-03-18

930 downloads per month

MIT license

21KB
490 lines

cargo-tomlfmt

Formatting Cargo.toml.

Build Status Build status

Installation

cargo install cargo-tomlfmt

Usage

cargo tomlfmt

Behavior

  • Formats all top-level tables, including [package].
  • In [features], keeps default first and sorts the rest alphabetically.
  • In [workspace], formats members as 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