Customizing Builds with Release Profiles
Cargo uses profiles to control how your code is compiled in different
contexts. The two most common profiles are dev (used by cargo build and
cargo run) and release (used by cargo build --release).
You can customize these profiles in Cargo.toml:
[profile.dev]
opt-level = 0
debug = true
[profile.release]
opt-level = 3
debug = false
lto = true
Common Settings
opt-levelcontrols optimization (0-3).debugcontrols debug info generation.ltoenables link-time optimization.paniccan beunwindorabort.
Use release builds for benchmarks or production deployments, and dev builds for fast iteration.