talira

cargo-sweep

A cargo subcommand for cleaning up unused build files generated by Cargo

open sourceMITself-hostablefree

cargo-sweep looks abandoned: it isn't maintained, though its makers haven't said it has ended.

Its README says cargo-sweep is currently unmaintained.

cargo-sweep deletes old or unused build artifacts from Rust target directories without a full cargo clean: by age, by toolchains no longer installed, or until a target directory is under a size limit, across many projects at once. The README currently marks it as unmaintained and points to cargo-clean-all.

Problems it solves

  • my Rust target folder is 40GB and cargo clean throws away everything
  • delete build artifacts older than 30 days but keep recent ones
  • clean out artifacts from Rust toolchains I've uninstalled
  • shrink the target directory before caching it in CI
  • clean every Rust project under ~/code in one go
  • keep target/ below a size limit automatically
  • nightly toolchain updates leave gigabytes of stale build files behind
  • preview which build files would be deleted before removing them

Features

  • clean by age
  • clean artifacts from uninstalled toolchains
  • size limit
  • recursive across projects
  • dry run

Capabilities

Has a command line toolplan not known

Alternatives

The same job

These do what cargo-sweep does.

  1. npkill Easily find and remove old and heavy node_modules, artifacts, caches and dev leftovers
  2. Kondo Cleans dependencies and build artifacts from your projects.
  3. Mr Boxington (mbx) A shared cache for Cargo builds
  4. cargo-cache manage cargo cache (${CARGO_HOME}, ~/.cargo/), print sizes of dirs and remove dirs selectively
  5. Kache Build once. Reuse the work.
  6. Mole Open-source Mac and PC cleaner. Keep your machine clean, light, and running like new.

Compare cargo-sweep with the top 3