Cargo Flags & Options
Rust build system and package manager.All Cargo pages
- cargo build --locked: fail if Cargo.lock needs to be updatedcargo build --locked fails when Cargo.lock is missing or needs changes instead of rewriting it. --offline, --frozen, cargo install --locked and a CI recipe.
- cargo build --no-default-features: build without the default feature setcargo build --no-default-features builds without the default feature list; combine with --features. --all-features, dependency defaults, unification, pitfalls.
- cargo build --release: optimised builds and target/releasecargo build --release uses the release profile (opt-level 3, no overflow checks) and writes to target/release. Debug vs release, and how to tune the profile.
- cargo test -- --nocapture: show println! output of passing testscargo test -- --nocapture shows println! output of passing tests; --show-output prints it after the run. Why it goes after --, test threads, env vars.