Skip to content

clippy::multiple_crate_versions ignores selected dependency crate features (no-default-features) #16440

@BioTomateDE

Description

@BioTomateDE

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

  1. Visit https://github.com/BioTomateDE/.BugClippyMultipleCrateVersions/
  2. Clone the repository
  3. Run cargo clippy - Should show multiple_crate_versions warnings
  4. Run cargo tree - None of the mentioned crates are listed
  5. Run cargo tree | grep thiserror - Empty output
  6. Run cargo tree | grep getrandom - Empty output
  7. Run cargo tree | grep windows - Empty output

More generically:

  1. Use default-features = false on one or more dependencies
  2. Have multiple dependencies which themselves both depend on the same crate (somewhere down the graph), but on a different version
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't have

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions