cargo
cargo fmt
Check formatting across the workspace using the rustfmt component. Without check mode, formatting changes source files. Formatting is about presentation and does not establish semantic correctness. This is a component-provided Cargo extension, not a built-in Cargo command. Install the matching component only in an authorized environment. Example format: shell. Run only in a disposable copy of the quality-demo fixture with preinstalled matching tools. Expected result (not executed): The formatted fixture is expected to pass without edits. Common mistake: Running the formatter in write mode when a CI check should only report differences.
Formal Syntax & Structure
rust syntaxrust
cargo fmt [OPTIONS] [-- RUSTFMT_OPTIONS]Working Example
Example Snippetrust
cargo fmt --all -- --check