Find unused crates in toml

is it possible to find if a crate that is listed as a dependency in the toml is unused in the crate?

2 Likes

You can add this your src/main.rs or src/lib.rs:

#![warn(unused_extern_crates)]

Despite rust-lang/rust#42588 being merged, this is still set to allow by default, at least in my nightly. There may still be some false positives this can produce?

This is not exactly what you're asking for, but it would be a necessary part of the solution, to make sure your code actually uses the "extern crate" declarations found in the code.

1 Like