14

How do I find out the dependencies in Cargo.toml that are unused? How can I remove them automatically?

z11i
  • 951
  • 11
  • 26

1 Answers1

15

One option is to use cargo-udeps.

You can install it via command:

cargo install cargo-udeps --locked

Then, to find unused dependencies in production target:

cargo +nightly udeps

To find unused dev dependencies:

cargo +nightly udeps --all-targets
blek__
  • 98
  • 1
  • 7
z11i
  • 951
  • 11
  • 26