Skip to content

multiple_crate_versions false negative in source repo but not as dependency #15643

@spearman

Description

@spearman

Summary

In the crate nsys-enet 0.1.0 I have:

[lints.clippy]
multiple-crate-versions = "warn"

And because of a dependency, both "num-traits 0.1.43" and "num-traits 0.2.19" are in the dependency graph. (I have replaced the dependency in v0.2.0 so this only applies to v0.1.0 of the crate, but I have encountered the same issue with other crates of mine with more dependencies).

However when running cargo clippy no warning is emitted. But if I create a new crate and add nsys-enet as a dependency and enable the multiple_crate_versions lint, then a warning is emitted:

warning: multiple versions for dependency `num-traits`: 0.1.43, 0.2.19
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_crate_versions
  = note: requested on the command line with `-W clippy::multiple-crate-versions`

I also encounter the same issue with the nsys-gl-utils crate, with a larger number of dependencies.

Version info:

rustc 1.91.0-nightly (9c27f27ea 2025-09-08)
cargo 1.91.0-nightly (761c4658d 2025-09-04)
clippy 0.1.91 (9c27f27ea3 2025-09-08)

Lint Name

multiple_crate_versions

Reproducer

I tried this code:

git clone https://github.com/spearman/enet-rs && cd enet-rs && git checkout v0.1.0 && cargo clippy

I expected to see this happen:

warning: multiple versions for dependency `num-traits`: 0.1.43, 0.2.19
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_crate_versions
  = note: requested on the command line with `-W clippy::multiple-crate-versions`

Instead, this happened:

[nothing]

Version

rustc 1.91.0-nightly (9c27f27ea 2025-09-08)
binary: rustc
commit-hash: 9c27f27ea3bab79a2fec827ef3ae0009959d60f4
commit-date: 2025-09-08
host: x86_64-unknown-linux-gnu
release: 1.91.0-nightly
LLVM version: 21.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingI-false-negativeIssue: The lint should have been triggered on code, but wasn't

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions