Get your disk back from cargo

Cargo Cleaner, built into Ruststudio, finds every Rust target folder and cargo cache on your disk, shows their size and age, and deletes only the ones you select, and only folders Cargo can rebuild.

Updated · describes Ruststudio 0.1.7

The Ruststudio Cargo Cleaner showing target folders and cargo caches with sizes
The Ruststudio Cargo Cleaner showing target folders and cargo caches with sizes

Every Rust project leaves a target folder that can grow past ten gigabytes, and cargo keeps every crate you ever downloaded. Find them all, see what is stale, and clear it safely.

Interactive

Cargo clean-up helper

Say what you want back. You get the command, what it frees, whether it is safe, and what the next build will cost.

What do you want to clean?

cargo clean

PowerShell
cargo clean                # in the project folder: removes its whole target directory
cargo clean --dry-run      # first, if you want to see what would go
Frees
The project’s whole target folder: debug, release and incremental caches. Often several gigabytes.
Safe?
Yes. Only build output is removed; Cargo makes it again.
Next build
A full rebuild of the project and every dependency, once.
In Ruststudio
The Clean command runs cargo clean for the open project, and the status bar shows the target size after every build.

How the Cargo Cleaner worksWhat is safe to delete in .cargo

What you get

Find

Every target folder

Scans your open project and any folders you add, up to six levels deep, skipping node_modules and version-control folders.

See

Size, age and parts

Each target shows when it was last built, and its debug, release and incremental parts, so you can drop only the biggest.

Caches

Cargo downloads and checkouts

Lists the registry cache, extracted sources and git checkouts. All of them are fetched again when needed.

Safe

Only cargo's own folders

It refuses to delete anything that is not a cargo target (with cargo's own tag file and a Cargo.toml beside it) or one of cargo's cache folders.

Select

Stale in one click

Select stale picks every target not built for 30 days. You confirm before anything is deleted.

Try it

Try the Cargo Cleaner

See every target folder and cache with its size and age, select the stale ones, and clean.

Ruststudio · Cargo CleanerInteractive · simulated

26.9 GB in 7 cargo folders

Tick folders, or use Select stale.

Try it: Select stale, look at what is chosen, clean, or tick the “not a cargo folder” row to see the safety check.

Why target folders get so big

Cargo keeps a separate build for every profile and every dependency version, plus incremental caches that make the next build faster. On a busy machine with a dozen projects that adds up to tens of gigabytes, and cargo clean only helps one project at a time.

The Cargo Cleaner shows all of them in one list, largest first, with the project name and last-built date, so you can see at a glance which old experiments are costing you space.

The Ruststudio Cargo Cleaner showing target folders and cargo caches with sizes
The Ruststudio Cargo Cleaner showing target folders and cargo caches with sizes

Built in, one shortcut away

Press Ctrl+Shift+L, or click the target size in the status bar. The status bar shows the size of the open solution's target folder after every build, so you notice growth before it becomes a problem.

Frequently asked questions

Something else? Ask in the community forum or send feedback.

Is there a cargo clean all command?

No. cargo clean removes the target folder of the one project you run it in; Cargo has no command that cleans every project. The Cargo Cleaner in Ruststudio lists every target folder under the folders you choose and cleans the ones you tick.

Does it clean automatically?

It can. Automatic cleaning removes the target folders of projects that have not been built for 30 days and trims the open project’s caches when they grow large, in the background. It leaves alone anything written in the last few minutes, and you can switch it off.

Will it delete my source code?

No. It can only delete cargo target folders (and folders inside them) and cargo's download caches. Your source stays untouched, and you confirm each deletion.

What happens after I clean?

The next build is slower once, because cargo rebuilds what was removed. Cargo caches are downloaded again when a build needs them.

How do I clean the cargo cache?

Delete old target folders first, then the registry cache and sources in the .cargo folder; Cargo downloads what it needs again. Ruststudio’s Cargo Cleaner lists all of them with size and age and removes the ones you select. Keep .cargo/bin, which holds cargo itself.

Does it work outside Ruststudio projects?

Yes. Add any folder as a scan folder and it finds every cargo target under it.

Is Ruststudio free?

Yes. Ruststudio is free for personal and commercial use, with no licence key and nothing to pay. Use it for 7 days straight away; after that you sign up for a free account with your e-mail address. It is closed-source freeware.

Who makes Ruststudio?

Ruststudio is a product of FOWLGUARD, Inc., the company behind Fowlguard Secure and Fowlguard Productivity. It is one of its free tools; see fowlguard.com.

Which systems does Ruststudio run on?

Windows 10 and 11 (64-bit), macOS 11 or later (Apple silicon and Intel) and Linux (x86-64, X11 or Wayland). You can build for the desktop, the web and Android from it. Native iOS support is in development and will need a Mac with Xcode.