-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get warning on unused crates in Cargo.toml #16
Comments
r/rust post about it: https://www.reddit.com/r/rust/comments/cvrglq/emitting_warnings_for_unused_crates_in_cargotoml/ Added the issue links in the top posts here also |
We've been using cargo-udeps a bit for this on linux and mac, does work and has been helpful! But does also require nightly Rust, doesn't work on Windows and has a bunch of false positives making it a bit difficult to automate |
I'm working on adding a builtin mode to cargo that will hopefully have less false positives than cargo-udeps. cargo-udeps has been built on a bunch of hacks and only had access to what the public cargo api gave it. Cargo instead has access to the full stuff. The mode is already better than cargo-udeps and I want to make it even better: |
@est31 that is awesome! looking forward to trying it out on our codebase when it hits nightly |
we've for now solved this with https://github.com/bnjbvr/cargo-machete that @bnjbvr built, it does have false positives but ways of working around them so we have this enabled in CI on our bigger projects. |
See also https://github.com/est31/cargo-udeps (untested) |
It would be great to be able to generate compile warning on unused crate specified in
Cargo.toml
, similar to#![warn(unused_extern_crates)]
but that works with Rust 2018 where one doesn't useextern crate
.This could also be implemented as an external cargo tool that one can run to verify (like clippy), but nicest to have built-in and automatic for everyone
clippy:
lint for unused cratesrust:
2018: fix lint on unused dependenciesThe text was updated successfully, but these errors were encountered: