cargo flags & options
build
Compile the current project.
cargo build
cargo build --release
run
Build and run the current project.
cargo run
cargo run --release -- --port 8080
test
Run the project's test suite.
cargo test
cargo test test_parsing
cargo test -- --nocapture
check
Analyze the code for errors without producing a binary, faster than build.
cargo check
clippy
Run the Clippy linter for idiomatic Rust suggestions.
cargo clippy
cargo clippy -- -D warnings
fmt
Format source code according to Rust style guidelines.
cargo fmt
cargo fmt -- --check
add
Add a dependency to Cargo.toml.
cargo add serde
cargo add serde --features derive
cargo add tokio --features full
update
Update dependencies in Cargo.lock to the latest compatible versions.
cargo update
cargo update -p serde
--features
Enable specific feature flags during compilation.
cargo build --features "json,logging"
cargo test --all-features
--target
Cross-compile for a different platform target.
cargo build --target x86_64-unknown-linux-musl
cargo build --release --target aarch64-apple-darwin