cargo-neat-0.2.4 is not a library.
cargo-neat
Keep your cargo workspace neat
About
A command to complement existing tools like cargo-machete when working with a Cargo workspace.
Features:
- detect unused dependencies in
workspace.dependencieswhen working with a cargo workspace - optionally enforce using only workspace dependency in your project (
-moption) - optionally enforce using only workspace metadata for some sections in workspace packages (
-poption). Metadata section values can be customized and currently defaults to--package-workspace-meta-values "rust-version,edition,license,homepage,repository"
Installation
Install with cargo:
Usage
&&
or alternatively
Sample output
The return code gives an indication whether unused dependencies have been found:
- 0 if it found no unused dependencies,
- 1 if it found at least one unused dependency,
- 2 if there was an error during processing (in which case there's no indication whether any unused dependency was found or not).
Usage with github actions
name: Cargo neat checks
on:
pull_request:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: taiki-e/checkout-action@v1 # or standard actions/checkout
- name: Install cargo neat
uses: taiki-e/install-action@v2
with:
tool: cargo-neat
- name: Run cargo neat
run: cargo neat -m -p
A working example can be found in cargo-neat CI
Inspiration
A lot of the code structure is drawn from the great cargo-machete. If you don't already use it, you probably should.
Similar tools
- est31/cargo-udeps: slow and requires Nightly rust, has no workspace features
- bnjbvr/cargo-machete: fast but does not remove unused workspace dependencies
- Boshen/cargo-shear: removes unused workspace dependencies, and can fix wrong dependency section, but cannot enforce using workspace dependencies only
I would need a mix of cargo-machete/shear and cargo-neat. However cargo-shear is marked feature complete and not accepting new features, so here is cargo-neat.