est31 / cargo-udeps

Find unused dependencies in Cargo.toml
Other
1.76k stars 46 forks source link

Upstream integration with cargo #276

Open joshtriplett opened 2 months ago

joshtriplett commented 2 months ago

In today's @rust-lang/cargo meeting, we discussed some of the issues and false positives with the upstream lint for unused crates. We're interested in trying to get Cargo to natively issue this lint, initially as something that can be enabled, and eventually something enabled by default.

See https://github.com/rust-lang/cargo/issues/6669#issuecomment-2326764167 - we agreed to try the experiment of adding an option for --all-targets-including-doc (which may become --all-targets in a future edition). That solves part of the problem.

It seems like that plus dep-info should give enough information to compute this without false positives.

@est31 Given the experience you have with cargo-udeps, we wondered if you'd be interested in prototyping adding this support natively to Cargo.

joshtriplett commented 2 months ago

Also, if you'd be interested in discussing this further, please feel free to either come by the Cargo office hours or the Cargo meeting.

est31 commented 2 months ago

we wondered if you'd be interested in prototyping adding this support natively to Cargo.

I would really love to do that! In fact I already have a PR to add such support to Cargo, the main blocker for it was a flag like --all-targets-including-doc.

feel free to either come by the Cargo office hours or the Cargo meeting.

I'll definitely try to get in touch with the greater Cargo team :).