Repository navigation
Don't warn about duplicates when a dependency is listed per target - #343
Merged
est31 merged 1 commit intoOct 22, 2026
Merged
Conversation
A package that is listed several times under the same name, e.g. once under `[target.'cfg(unix)'.dependencies]` and once under `[target.'cfg(not(unix))'.dependencies]`, made cargo-udeps print "duplicate package mentioned in toml". Nothing is lost in that case, so only warn when the names in the toml differ. The test runner can now return what was written to stderr, so the regression test can check that the warning is gone. Fixes #192 Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #192
When a crate lists the same package more than once under the same name, for example
cargo-udeps prints
warning: duplicate package mentioned in toml if_chain v1.0.3. if_chain. Both entries map the package to the same name, so nothing gets lost and the warning is just noise. Now it only warns when the names in the toml are different.To test it I let the test runner hand back what was written to stderr (
run_with_stderr;runbehaves as before) and addedtests/target-specific-dep.rs. It fails on master with the warning above and passes with this change. The rest of the test suite still passes.One thing to note: cargo itself already rejects the same package listed under different names (apart from
-vs_), so after this the warning rarely fires. I kept it rather than removing it, but I'm happy to drop it entirely if you prefer.I used Claude Code to write this change.