Rust and Cargo 1 cheatsheet
Rust and Cargo 1: Dependencies
8 common Rust and Cargo 1 tasks.
Add a dependency
Add a crate to Cargo.toml, here serde with its derive macros.
cargo add serde --features derive
Add a development dependency
Add a crate used only for tests and examples.
cargo add --dev pretty_assertions
Find duplicate crate versions
List crates that appear in more than one version.
cargo tree --duplicates
Install a command-line tool
Build and install a crate's binary into ~/.cargo/bin.
cargo install ripgrep
Check for vulnerable dependencies
Check Cargo.lock against the RustSec advisory database. Needs cargo-audit installed.
cargo install cargo-audit && cargo audit