cargo-shear
Finds and removes unused dependencies from Rust projects. Use when cleaning up a Rust repository, removing dead deps, or auditing Cargo.toml.
Installation
Follow the repository instructions for this skill and your agent. Review the files and dependencies before adding it to your workflow.
View source ↗GuidesSkill instructions
cargo-shear
Detects and removes unused dependencies from Cargo.toml files.
Usage
Find unused dependencies
cargo shear
Fix automatically (remove unused deps)
cargo shear --fix
Key Options
-
--fix- Automatically remove unused dependencies from Cargo.toml -
--ignore <CRATE>- Ignore specific crate (for false positives)
Workflow
- Run
cargo shearto list unused deps - Review the output for false positives (proc macros, build deps, optional features)
- Run
cargo shear --fixto remove them - Run
cargo buildto verify nothing broke
Common False Positives
Some deps may appear unused but are actually needed:
- Proc macro crates (e.g.,
serde_derive) - Build dependencies
- Crates used only via feature flags
- Crates re-exported by other crates
Use --ignore <CRATE> for legitimate false positives.
Examples
Read the usage examples in the source repository.
View source ↗Source history
- Indexed on
- 2026-01-20
- Index updated
- 2026-03-03
- Branch
- main
Index and sync dates describe this directory. View the source repository for code history.
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!