multiple_crate_versions
doesn't report when name contains a dash
#12145
Labels
C-bug
Category: Clippy is not doing the correct thing
Summary
When using
multiple_crate_versions
on a crate with an dash in the name themultiple_crate_versions
does not trip.If you use
multiple_crate_versions
on a crate without a-
, so either a_
or just no-
at all, the lint works as expected.Is it because
LOCAL_CRATE
(link) is normalized, i.e.-
is replaced by_
. Further down, comparing it top.name
(link) that is an issue asp.name
has the package name (with-
intact), not the normalized name.Fix: #12146
Reproducer
Setup 1 (with dash in name):
cargo new with-dash cd with-dash cargo add regex stubr --quiet cargo tree --depth 1 cargo clippy --quiet -- --deny clippy::multiple_crate_versions
Output 1:
Setup 2 (with underscore in name):
cargo new with_underscore cd with_underscore cargo add regex stubr --quiet cargo tree --depth 1 cargo clippy --quiet -- --deny clippy::multiple_crate_versions
Output 2:
Setup 3 (with nothing in the name, just one word):
cargo new justoneword cd justoneword cargo add regex stubr --quiet cargo tree --depth 1 cargo clippy --quiet -- --deny clippy::multiple_crate_versions
Output 3:
Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: