Compile with the release profile.
Section: Build and run
Build optimized release artifacts
bash
bash
cargo build --releaseExplanation
Uses the `release` profile for optimized builds.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Build and run
Type-check without producing binaries
Validate code quickly without final artifacts.
Build and run the default binary
Compile if needed and execute the program.
Pass arguments to the binary
Separate Cargo flags from program flags with `--`.
Run a specific binary target
Choose which binary to execute in multi-bin packages.