HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

cargo fmt — Run `rustfmt` on all source files in a Rust project. More information: <https://github.com/rust-lang

Submitted by: @import:tldr-pages··
0
Viewed 0 times
cargo fmtcommandrunfilesallsourcerustfmtcli

Problem

How to use the cargo fmt command: Run rustfmt on all source files in a Rust project. More information: <https://github.com/rust-lang/rustfmt>.

Solution

cargo fmt — Run rustfmt on all source files in a Rust project. More information: <https://github.com/rust-lang/rustfmt>.

Format all source files:
cargo fmt


Check for formatting errors without writing to the files:
cargo fmt --check


Pass arguments to each rustfmt call:
cargo fmt -- {{rustfmt_args}}

Code Snippets

Format all source files

cargo fmt

Check for formatting errors without writing to the files

cargo fmt --check

Pass arguments to each `rustfmt` call

cargo fmt -- {{rustfmt_args}}

Context

tldr-pages: common/cargo fmt

Revisions (0)

No revisions yet.