Determining Unused Cargo.toml dependencies


Question for you all - I haven’t found a good answer for this, but I ran into something while refactoring my monolithic crate (3 binaries, one shared library) into a workspace where it was unclear which dependencies in my single Cargo.toml needed to be present for each project under the new workspace structure.

I ended commenting out all dependencies and adding them back in one at a time until the compiler was happy. This doesn’t seem optimal (although it definitely works) - is there a cargo subcommand that would have issued warnings about unused dependencies in each of my Cargo.tomls that I could have run instead?



You probably did it the most reliable way. I think this is the current state of rust support: