rustfmt
rustfmt
TLDR
Format a file, overwriting the original file in-place
Check a file for formatting and display any changes on the console
Backup any modified files before formatting (the original file is renamed with a .bk extension)
Help
Format Rust code
usage: rustfmt [options]
Options:
--check Run in 'check' mode. Exits with 0 if input is
formatted correctly. Exits with 1 and prints a diff if
formatting is required.
--emit [files|stdout]
What data to emit and how
--backup Backup any modified files.
--config-path [Path for the configuration file]
Recursively searches the given path for the
rustfmt.toml config file. If not found reverts to the
input file path
--edition [2015|2018|2021]
Rust edition to use
--color [always|never|auto]
Use colored output (if supported)
--print-config [default|minimal|current] PATH
Dumps a default or minimal config to PATH. A minimal
config is the subset of the current config file used
for formatting the current program. `current` writes
to stdout current config as if formatting the file at
PATH.
-l, --files-with-diff
Prints the names of mismatched files that were
formatted. Prints the names of files that would be
formated when used with `--check` mode.
--config [key1=val1,key2=val2...]
Set options from command line. These settings take
priority over .rustfmt.toml
-v, --verbose Print verbose output
-q, --quiet Print less output
-V, --version Show version information
-h, --help [=TOPIC] Show this message or help about a specific topic:
`config`