3.2. Using rustfmt as a standalone tool
Use rustfmt as a standalone tool to format a Rust source file and all its dependencies. As an alternative, use rustfmt with the Cargo build tool. For more information, see Using rustfmt with the Cargo build tool.
Prerequisites
Procedure
Format the Rust source code:
$ rustfmt <source-file>Replace
<source_file>with the name of your source file. Alternatively, you can replace<source_file>with standard input. Therustfmtutility then provides its output in standard output.중요By default,
rustfmtmodifies the affected files without displaying details or creating backups. To display details and create backups, runrustfmtwith the--write-modeoption.