Proposal: Adding a prune command/flag to the cargo CLI #13234
Labels
A-crate-dependencies
Area: [dependencies] of any kind
C-feature-request
Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
S-blocked-external
Status: ❌ blocked on something out of the direct control of the Cargo project, e.g., upstream fix
Problem
Dependencies may be left orphaned or unused in a project as it grows and changes. This can increase build times and storage requirements for developer workstations. While it is up to developers to ensure their dependencies are in order, issuing a cargo command to remove these dependencies would be beneficial.
This seems like a common enough use case among developers to integrate it with the Cargo CLI.
Proposed Solution
Implementing a prune command
cargo prune --[flags]
to automatically mark unused dependencies. Some flags to consider would be a dry-run flag, dev dependencies only, and more.Notes
Docker has a similar command
docker image prune
which will remove all unused images in a local registry. docsNpm has a similar solution. docs
There is an existing solution to this problem. github
The text was updated successfully, but these errors were encountered: