-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Summary
The clippy::multiple_crate_versions lint incorrectly warns about dependency "conflicts" for crates that are disabled using --no-default-features. This is a false positive and not very helpful, as these dependencies are not even downloaded or compiled.
Specifics
The lint claims that my crate's dependencies use multiple versions of thiserror, getrandom as well as some Windows sys crates.
However, I use default-features = false on my dependencies and do not use any Windows related features.
Therefore, this lint is a false positive, since these dependencies are not truly being used. This can be confirmed by running cargo tree, which neither shows anything about thiserror, nor about getrandom, nor about windows_*.
Lint Name
multiple_crate_versions
Reproducer
- Visit https://github.com/BioTomateDE/.BugClippyMultipleCrateVersions/
- Clone the repository
- Run
cargo clippy- Should showmultiple_crate_versionswarnings - Run
cargo tree- None of the mentioned crates are listed - Run
cargo tree | grep thiserror- Empty output - Run
cargo tree | grep getrandom- Empty output - Run
cargo tree | grep windows- Empty output
More generically:
- Use
default-features = falseon one or more dependencies - Have multiple dependencies which themselves both depend on the same crate (somewhere down the graph), but on a different version
- Unprofit
Version
rustc 1.92.0 (ded5c06cf 2025-12-08)
binary: rustc
commit-hash: ded5c06cf21d2b93bffd5d884aa6e96934ee4234
commit-date: 2025-12-08
host: x86_64-unknown-linux-gnu
release: 1.92.0
LLVM version: 21.1.3
Additional Labels
No response