RUSTFMT(1) General Commands Manual RUSTFMT(1) NAME rustfmt - Formater for Rust code SYNOPSYS rustfmt [OPTIONS] INPUT rustfmt [source.rs] Format a file, overwriting the original file in-place: rustfmt --check [source.rs] Check a file for formatting and display any changes on the console: rustfmt --backup [source.rs] Backup any modified files before formatting (the original file is renamed with a .bk extension): DESCRIPTION This program is a formater for Rust language code, available at https://www.rust-lang.org. 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|coverage|checkstyle|json] 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 format‐ ting 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 --unstable-features Enables unstable features. Only available on nightly channel. --file-lines JSON Format specified line ranges. Run with `--help=file-lines` for more detail (unstable). --error-on-unformatted Error if unable to get comments or string literals within max_width, or they are left with trailing whitespaces (un‐ stable). --skip-children Don't reformat child modules (unstable). -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` or `file-lines` RUSTFMT(1)