Rust Tools
- Standard Rust tools:
cargorustcrustuprustdocrustfmtclippyjustmdbookbindgenmiri - Cargo plugins:
cargo-editcargo-clean-allcargo-denycargo-licensecargo-auditcargo-generate - More Rust tools:
clippy-controlwasm-bindgen - Non-Rust tools for Rust:
mold - More general developer tools:
ripgreptokeibasic-http-servergistjaqjsonxffdsddust
Standard Rust tools
π cargo
The Rust build and packaging tool.
It is the central tool in most Rust development workflows.
It is part of every Rust toolchain,
usually managed by rustup.
ποΈ The
cargoBook
π rustc
The Rust compiler.
It is usually invoked through cargo.
ποΈ The
rustcBook
π rustup
The Rust toolchain installer and version manager.
ποΈ The
rustupBook
π rustfmt
A tool for formatting Rust code. Included with Rust toolchains.
rustup component add rustfmt
ποΈ The
rustfmtBook
π clippy
A collection of lints to catch common mistakes and improve your Rust code.
rustup component add clippy
ποΈ The
clippyBook
π rustdoc
The Rust documentation generator.
Usually invoked through cargo doc.
ποΈ The
rustdocBook
π mdbook
A utility to create modern online books from Markdown files.
cargo install mdbook
π
crates.ioPage
ποΈ The mdBook Book
π bindgen
Automatically generates Rust FFI bindings to C libraries.
cargo install bindgen-cli
π
crates.ioPage
ποΈ The bindgen User Guide
π miri
An interpreter for Rustβs mid-level intermediate representation. Useful for detecting undefined behavior.
rustup component add miri
ποΈ Source Repository
Cargo plugins
π cargo-edit
Extra cargo subcommands for editing Cargo.toml.
cargo install cargo-edit
π
crates.ioPage
ποΈ Source Repository
Installing cargo-edit provides two cargo subcommands:
cargo add
was once provided by cargo-edit but since Rust 1.62.0
is built into cargo itself.
π cargo-clean-all
Recursively clean all Cargo projects in a directory tree.
cargo install cargo-clean-all
π
crates.ioPage
ποΈ Source Repository
π cargo-deny
Cargo plugin for linting your dependencies. Checks for security vulnerabilities, licenses, and more.
cargo install cargo-deny
π
crates.ioPage
ποΈ Source Repository
π cargo-license
Displays the license of dependencies.
cargo install cargo-license
π
crates.ioPage
ποΈ Source Repository
π cargo-audit
Audit Cargo.lock files for known security vulnerabilities.
cargo install cargo-audit
π
crates.ioPage
ποΈ Source Repository
π cargo-generate
Generate a new Rust project from a template.
cargo install cargo-generate
π
crates.ioPage
ποΈ Source Repository
More Rust tools
π clippy-control
Temporarily allow/deny clippy lints from the command line.
cargo install clippy-control
π
crates.ioPage
ποΈ Source Repository
π wasm-bindgen
Generates the JavaScript glue that loads a wasm32-unknown-unknown module
built with the wasm-bindgen crate, and rewrites the module to match.
Its version must exactly match the version of the wasm-bindgen crate
in the projectβs Cargo.lock.
wasm-pack and trunk run it as part of their builds.
rustmax install-tool wasm-bindgen
π
crates.ioPage
ποΈ Thewasm-bindgenGuide
Non-Rust tools for Rust
π mold
A high-performance linker that significantly speeds up Rust builds on Linux.
rustmax install-tool mold
ποΈ Source Repository
Linking is one of the most time-consuming stages of a Rust build,
and it has to be redone every time you test your program.
On Linux the mold linker is faster than the default linker.
Setting up mold manually requires configuring .cargo/config.toml
and ensuring the linker is properly installed,
but the Rustmax CLI tool handles this setup automatically.
More general developer tools
π ripgrep
A line-oriented search tool that recursively searches your current directory for a regex pattern. Faster than grep and respects gitignore.
Documented in the legendary blog post, βripgrep is faster than β¦β.
cargo install ripgrep
π
crates.ioPage
ποΈ Source Repository
π just
A simple and suprisingly useful command runner with make-like syntax.
cargo install just
π
crates.ioPage
ποΈ Source Repository
Almost every project has a handful of commands the developer(s)
uses frequently. Put these in a justfile so the menu of
commands for this project is always obvious, which
can be extra helpful after years away from a project.
just runs commands listed in a file named justfile.
The justfile lives your projectβs root directory,
and is configured with a make-like syntax:
default:
just --list
install-tools:
cargo install mdbook
cargo install mdbook-yapp
clean: doc-clean
cargo clean
doc-clean:
rm -rf out
Itβs a simple idea, but suprisingly useful. And donβt worry that it looks like
a Makefile β it is much more fun and sensible in use than make.
When you come back to a project and see thereβs a justfile you
know to run just --list and youβll immediately see what
was on the previous maintainerβs mind.
$ just --list
Available recipes:
build
check
clean
default
doc-book
doc-build
doc-clean
doc-crates
install-tools
lint
maint-audit
maint-duplicates
maint-lock-minimum-versions # useful prior to running `cargo audit`
maint-outdated
maint-upgrade
publish
publish-dry
replace-version old new
test
test-min-version-build
$ just build
Compiling rustmax-cli v0.0.5 (β¦/rustmax/crates/rustmax-cli)
β¦
π tokei
A program for counting lines of code quickly.
cargo install tokei
π
crates.ioPage
ποΈ Source Repository
π basic-http-server
A simple HTTP server for serving static files.
cargo install basic-http-server
π
crates.ioPage
ποΈ Source Repository
π gist
Upload code to GitHub Gist from the command line.
cargo install gist
π
crates.ioPage
ποΈ Source Repository
π jaq
A jq clone focused on correctness, speed, and simplicity.
cargo install jaq
π
crates.ioPage
ποΈ Source Repository
π jsonxf
A JSON transformer and formatter.
cargo install jsonxf
π
crates.ioPage
ποΈ Source Repository
π fd
Find files recursively. A simple, fast and user-friendly alternative to βfindβ.
Pair with sd to search and replace.
cargo install fd-find
π
crates.ioPage
ποΈ Source Repository
π sd
Intuitive find & replace CLI, sed alternative,
pair with fd.
cargo install sd
π
crates.ioPage
ποΈ Source Repository
π dust
Show disk usage. A more intuitive version of du.
cargo install du-dust
π
crates.ioPage
ποΈ Source Repository