Mettā

decentralized internets

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 2025-01-12):

Commands that run via cargo

Sorted alphabetically:

cargo-aoc crates.io - Advent of Code helper.

cargo-audit crates.io - audit Cargo.lock for security vulnerabilities.

cargo-binutils crates.io - proxy for LLVM tools like llvm-nm, llvm-objdump and llvm-size. Beware of nasty LLVM bugs like this one.

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

cargo-bundle crates.io - create OS-specific app bundles from rust binaries.

cargo-cache crates.io - manage and clean cargo cache.

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

cargo-deny crates.io - manage large dependency graphs, check licenses, security advisories or outright ban certain packages.

cargo-dfu crates.io - flash embedded firmware using DFU.

cargo-edit crates.io - cargo add, cargo rm, and cargo upgrade Cargo.toml dependencies.

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

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

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

cargo-fuzz crates.io - use libFuzzer to fuzz your code easily.

cargo-geiger crates.io - count number of unsafe operations in crate and its dependencies.

cargo-generate crates.io - generate cargo project from a given template.

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

cargo-insta crates.io - snapshot testing using insta.

cargo-make crates.io - a decent replacement for make.

cargo-outdated crates.io - display out-of-date dependencies.

cargo-play crates.io - instant playground. Run your code from single .rs file like if it was a full rust project.

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

cargo-show-asm crates.io - see the assembly (with cargo asm --asm) or llvm-ir (with cargo asm --llvm or --llvm-input) generated for Rust code. This is an updated version of the unmaintained cargo-asm crate. Install with cargo install --locked --all-features cargo-show-asm.

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

cargo-sweep crates.io - clean unused build files.

cargo-testify crates.io - show popup notifications about testing results.

cargo-tree crates.io - visualise crate dependencies as a tree.

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

cargo-vendor crates.io - vendor dependencies into a local directory.

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

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

Standalone commands

Sorted alphabetically:

aarch64-esr-decoder crates.io - decode aarch64 Exception Syndrome Register values quickly.

bandwhich crates.io - a CLI network monitor.

bat crates.io - cat with wings. Replace your cat command with a nicer one by doing "alias cat bat".

bingrep crates.io - cross-platform binary parser and colorizer. See binary file headers in a nice way.

biodiff crates.io - compare binary files using sequence alignment. Makes it easier to see diffs in files that are aaaalmost the same.

bootimage crates.io - create a bootable OS image from a kernel binary. Integrates with cargo.

broot crates.io - a CLI file manager with nice tree navigation.

cc-cli crates.io - git hook for conventional commits - "git commit" and pick details using a CLI.

clog-cli crates.io - conventional commits changelog generator. Old.

cocogitto crates.io - conventional commits swiss army knife. Does everything.

commit-emoji crates.io - git hook to add emoji to your conventional commits. Disclosure: This is my crate.

convco crates.io - conventional commits tooling, similar to cocogitto.

dirstat-rs crates.io - graphical (CLI) directory tree size statistics. Really nice and fast.

dts_viewer crates.io - a CLI viewer for device tree files (DTS, source).

du-dust crates.io - graphical (CLI) disk usage statistics. Pretty and fast.

dua-cli crates.io - Disk Usage Analyzer. Graphical (CLI) disk usage statistics.

elfcat crates.io - generates a cross-referenced HTML file with contents of an input ELF binary.

erdtree crates.io - a nicely looking file tree. Be sure to set up one of Nerd Fonts in your terminal.

eza crates.io - a modern ls replacement. Do alias ls eza.

fd-find crates.io - super fast and simple alternative to find. Do alias find fd for your interactive sessions (the CLI is not compatible with find so keep the scripts happy).

fdtdump crates.io - dump device tree files (DTB, compiled).

just crates.io - a quick and easy tool runner, useful for automating repeated tasks.

version-sync crates.io - keep your version number in documentation and elsewhere in sync with version specified in Cargo.toml

Building WASM with Rust home Reboot to Rust