table of contents
| CARGO-MACHETE(1) | User Commands | CARGO-MACHETE(1) |
NAME¶
cargo-machete - find unused dependencies in Rust projects
SYNOPSIS¶
cargo-machete [OPTIONS] [PATH]
DESCRIPTION¶
cargo-machete helps find unused dependencies in a fast yet imprecise way.
Run cargo-machete in a directory that contains one or more Rust projects using Cargo for dependency management. If no paths are provided, it defaults to the current working directory.
OPTIONS¶
- --with-metadata
- Uses cargo-metadata to figure out the dependencies' names. May be useful if some dependencies are renamed from their own Cargo.toml file (e.g. xml-rs which gets renamed xml). Try it if you get false positives!
- --skip-target-dir
- Don't analyze anything contained in any target/ directories encountered.
- --fix
- Rewrite the Cargo.toml files to automatically remove unused dependencies.
- Note: all dependencies flagged by cargo-machete will be removed, including false positives.
- --no-ignore
- Also search in ignored files (.gitignore, .ignore, etc.) when searching for files.
- --version
- Print version.
- --help, help
- Display usage information.
EXIT STATUS¶
cargo-machete returns the following exit codes:
- 0
- When no unused dependencies are found.
- 1
- When at least one unused (non-ignored) dependency is found.
- 2
- On error.
AUTHOR¶
This manual page was written by Ching He <heqing@rool.me> for the Debian project (and may be used by others).
| June 2026 | cargo-machete |