Rust and Cargo 1 cheatsheet
Rust and Cargo 1: Testing and code quality
9 common Rust and Cargo 1 tasks.
Show test output
Show what tests print. Output is hidden for passing tests by default.
cargo test -- --nocapture
Run benchmarks
Run benchmarks. The built-in harness needs the nightly toolchain, so most projects use criterion.
cargo bench
Lint the code
Run clippy and treat warnings as errors, as many CI pipelines do.
cargo clippy -- -D warnings
Check a crate before publishing
Package and verify a crate without uploading it.
cargo publish --dry-run