Dependencies

Detect unused dependencies

You could use the default warning flag to detect them.

$ RUSTFLAGS=-Wunused-crate-dependencies cargo ...

warning: external crate `regex` unused in `playground`: remove the dependency or add `use regex as _;`
 --> src/main.rs:3:1
  |
3 | fn main() {
  | ^
  |
  = note: requested on the command line with `-W unused-crate-dependencies`

Or you could use third-party tools like:

Reference: Reddit

Last updated