-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
unused_crate_dependencies false positive for dev-dependencies on main crate #129637
Copy link
Copy link
Open
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.L-false-positiveLint: False positive (should not have fired).Lint: False positive (should not have fired).L-unused_crate_dependenciesLint: unused_crate_dependenciesLint: unused_crate_dependenciesT-cargoRelevant to the cargo team, which will review and decide on the PR/issue.Relevant to the cargo team, which will review and decide on the PR/issue.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.L-false-positiveLint: False positive (should not have fired).Lint: False positive (should not have fired).L-unused_crate_dependenciesLint: unused_crate_dependenciesLint: unused_crate_dependenciesT-cargoRelevant to the cargo team, which will review and decide on the PR/issue.Relevant to the cargo team, which will review and decide on the PR/issue.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Steps to reproduce:
Result:
dev-dependencies have a variety of uses, and should not be considered as potentially unused. I'd love to see unused dev-dependencies detected as well, but right now they produce false positives.
The reverse is also true: rustc will warn about unused non-dev dependencies when compiling tests.
Short-term, perhaps we could provide a way to easily disable this warning entirely for dev-dependencies, and for non-dev dependencies in targets such as tests.
Longer-term, perhaps rustc could feed information about potentially unused dependencies back to Cargo in its output, and Cargo could then aggregate the intersection of those dependencies that are completely unused.
Meanwhile, however, these false positives make it difficult to use
unused_crate_dependenciesin any project that has dev-dependencies or tests.