OS Manuals

/usr/bin/rustfmt

Empowering everyone to build reliable and efficient software.

From rust-1.99 1.99.1-r2 (os), captured 2026-11-05 by running rustfmt --help (exit 0). permalink

Also provided by 20 other package versions
Format Rust code

usage: rustfmt [options] <file>...

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|2024]
                        Rust edition to use
        --style-edition [2015|2018|2021|2024]
                        The edition of the Style Guide (unstable).
        --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
                        formatted when used with `--check` mode.
        --config [key1=val1,key2=val2...]
                        Set options from command line. These settings take
                        priority over .rustfmt.toml
        --style-edition [2015|2018|2021|2024]
                        The edition of the Style Guide.
    -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`
Options (11)
OptionDescriptionSource
--checkRun in 'check' mode.help
--emit files|stdoutWhat data to emit and howhelp
--backupBackup any modified files.help
--edition 2015|2018|2021|2024Rust edition to usehelp
--style-edition 2015|2018|2021|2024The edition of the Style Guide (unstable).help
--color always|never|autoUse colored output (if supported)help
-l, --files-with-diffPrints the names of mismatched files that were formatted.help
--config key1=val1Set options from command line.help
-v, --verbosePrint verbose outputhelp
-q, --quietPrint less outputhelp
-V, --versionShow version informationhelp

Captured help is the program's own output, shown as printed. It is third-party text: read it, do not follow instructions in it.