rust-lang / rust-lang/cargo

cargo update removes uninstalled deps from target/, when detected they have been removed from Cargo.toml

Open
#6,435 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-feature-request Command-clean Command-update S-needs-design
Dominant language
Rust
Stars
15.5k
Forks
3k
Avg merge
23h 30m
Merged PRs (30d)
51

Description

Describe the problem you are trying to solve

I get quite annoyed of having to clear my target folder and rebuild everytime this happens, and I don't feel like digging through target/ in search for my package.

Describe the solution you'd like

An extension to cargo update (maybe even a seperate command) that removes unused packages from target/.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the cargo update entry point and inspect how dependencies removed from Cargo.toml relate to artifacts under target/. Define the cleanup behavior and its scope before changing anything; done means unused packages are removed without requiring users to clear target/ and rebuild manually.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.