Skip to content
masterclass Buddy

Rust · Command

cargo fmt

cargo fmt formats the current crate's binary and library Rust files with rustfmt. Because rustfmt is optional and external to Cargo, it may need separate installation.

Last updated

Syntax

cargo fmt

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • cargo
  • cargo-fix
  • cargo-clippy
  • Custom subcommands

Source: cargo fmt - The Cargo Book. Checked 2026-11-03.