Useful cargo commands

Some additional cargo commands exist to provide unprecedented level of support and extensibility to regular cargo. Here's a list of commands I use (will be updated over time, last update 2018-05-01):

cargo-edit - cargo add, cargo rm, cargo upgrade Cargo.toml dependencies.

cargo-watch - add a cargo watch command to monitor and rebuild source in case of changes.

cargo-bloat - find out what takes most of the space in your executable.

cargo-asm - see the assembly (with cargo asm) or llvm-ir (with cargo llvm-ir) generated for Rust code.

cargo-clippy - over 300 lints to make your Rust code tidy.

cargo-expand - show result of macro expansion and #[derive] expansion.

cargo-fmt - format Rust code, applies rustfmt to entire crate.

cargo-graph - create GraphViz DOT files and dependency graphs.

cargo-update - add cargo install-update command to upgrade already installed binaries.

cargo-src - detailed rust source code browser with semantic details.

cargo-testify - show popup notifications about testing results.

cargo-tree - visualise crate dependencies as a tree.

cargo-vendor - vendor dependencies into a local directory.

cargo-web - automatically build and run web projects (use with parcel for amazing results).

cargo-fix - automatically apply fix-it suggestions from rustc and clippy to entire project. For better effect, run cargo clean first, then cargo fix --clippy.

cargo-release - for when you're ready to share your crate with the world, automates mundane release tasks - bumping versions, tagging repo, updating docs, etc.

comments powered by Disqus