cargo-gc-target

A cargo sub-command to delete unused files in your cargo target directory.

Installation

shell cargo install cargo-gc-target

Your cargo version should be at least 1.51.0.

Usage

In your project/workspace directory, simple run:

shell cargo gc

Note: It's gc. Not gc-target.

It can automatically follow custom target-dir specified in .cargo/config or environment variable CARGO_TARGET_DIR.

Limitations

Supported directories to GC

| Path | Content | GC supported? | | --- | --- | --- | | target/<profile>/deps | Artifacts of dependencies | ✅ | | target/<profile>/build | Build scripts and outputs | ✅ | | target/<profile>/.fingerprint | Cargo fingerprints | ✅ | | target/<profile>/<bin> | Final binary or libraries | ✅ | | target/<profile>/incremental | Rustc incremental temps | | | target/<profile>/examples | Example artifacts | | | target/doc | Documentations | |

License

MIT Licensed.