-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
rustc_lint: Remove unused_crate_dependencies
from the unused
group
#72702
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
Hm, does the lint itself have lots of false positives then? Most projects deny all warnings in CI, so whether it's part of unused or not doesn't seem like it would matter that much? |
@Mark-Simulacrum |
r=me if you wish. Can we create a tracking ticket to make sure we eventually figure out how to make |
@bors r=estebank rollup
I'm not sure whether it's a part of rust-lang/cargo#7916 or some other related existing issue. |
📌 Commit 1eef0c3 has been approved by |
Oh I think I missed that it's already allow-by-default then, thanks! |
I don't think it is possible for Cargo to support this lint as-is for normal builds (without the false positives). There are a few alternatives:
As I mentioned in the original PR, I feel like this lint is only useful for non-cargo build systems, or adventurous people who want to wade through the false positives. I would recommend cargo-udeps otherwise. It might be possible for cargo-udeps to use this lint as an alternative to its other approaches (it has multiple backends). |
One workflow that I might imagine where we could reduce the false-positives is to tell Cargo in some JSON-y format about the diagnostics, but not actually emit them by default. Then Cargo would aggregate them and be able to say "this dependency is not used by any target" -- in particular, to detect cases where e.g. you stopped using a dependency entirely. I agree that this happens somewhat rarely so maybe is not the most important thing to do, though. |
@Mark-Simulacrum see discussion in #57274. You can bikeshed a lot about the design whether to make rustc emit the used dependencies or the unused ones, and which format to use (modifying the existing stdout json format, storing json to disk, stabilizing build-dep-depinfo and using .dep files, etc), but:
Maybe I should make a table about which cargo subcommand has enough data to check which dependency section in Cargo.toml. |
Rollup of 12 pull requests Successful merges: - rust-lang#72239 (Implement PartialOrd and Ord for SocketAddr*) - rust-lang#72466 (Stabilize str_strip feature) - rust-lang#72605 (Add working example for E0617 explanation) - rust-lang#72636 (Cleanup `Resolver::<clone|into>_outputs` methods) - rust-lang#72645 (Add myself to .mailmap) - rust-lang#72667 (expand unaligned_references test) - rust-lang#72670 (Fix incorrect comment in generator test) - rust-lang#72674 (Clippy should always build) - rust-lang#72682 (Add test for rust-lang#66930) - rust-lang#72695 (update data layout for illumos x86) - rust-lang#72697 (Remove rustc-ux-guidelines) - rust-lang#72702 (rustc_lint: Remove `unused_crate_dependencies` from the `unused` group) Failed merges: r? @ghost
Fixes #72686
It's undesirable to enable
unused_crate_dependencies
with blanket#![deny(unused)]
due to the amount of redundant--extern
options passed by Cargo.