Clippy: Multiple crate versions

Clippy

Adding

[lints.clippy]
cargo        = { priority = -1, level = "deny" }

to Cargo.toml will also turn on the multiple_crate_versions rule.

It will them complain if the same create was added more than once (with different version numbers) to Cargo.lock.

How could this happen?

What to do about it?

  1. We can decide to disregard this rule. Add the following line to Cargo.toml
[lints.clippy]
multiple_crate_versions = "allow"
  1. Tell Clippy about the specific crates for which we allow the duplication:

Create the clippy.toml file and add the following entry, with the names of the crates we allow to be duplicated:

allowed-duplicate-crates = [
    "async-channel",
    "event-listener",
    "foldhash",
    "hashbrown",
    "hashlink",
    "wit-bindgen",
]

See allowed-duplicate-crates.

  1. Figure out which of our dependencies brought in these dependencies and either replace our own dependencies, or send a Pull-Request to our dependencies to allow for more flexibility.

Author

Gabor Szabo (szabgab)

Gabor Szabo, the author of the Rust Maven web site maintains several Open source projects in Rust and while he still feels he has tons of new things to learn about Rust he already offers training courses in Rust and still teaches Python, Perl, git, GitHub, GitLab, CI, and testing.

Gabor Szabo