Skip to content

Commit d975e26

Browse files
fix: add fix for bug, fix test name
1 parent 5769c21 commit d975e26

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

clippy_lints/src/cargo/multiple_crate_versions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub(super) fn check(cx: &LateContext<'_>, metadata: &Metadata) {
1616

1717
if let Some(resolve) = &metadata.resolve
1818
&& let Some(local_id) = packages.iter().find_map(|p| {
19-
if p.name == local_name.as_str() {
19+
if p.name.replace('-', "_") == local_name.as_str() {
2020
Some(&p.id)
2121
} else {
2222
None

tests/ui-cargo/multiple_crate_versions/12145_with_dashes/Cargo.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ error: multiple versions for dependency `winapi`: 0.2.8, 0.3.9
33
= note: `-D clippy::multiple-crate-versions` implied by `-D warnings`
44
= help: to override `-D warnings` add `#[allow(clippy::multiple_crate_versions)]`
55

6-
error: could not compile `multiple-crate-versions-with-dashes` (bin "multiple-crate-versions-with-dashes") due to 1 previous error
6+
error: could not compile `multiple-crate-versions` (bin "multiple-crate-versions") due to 1 previous error

tests/ui-cargo/multiple_crate_versions/12145_with_dashes/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Should not lint for dev or build dependencies. See issue 5041.
22

33
[package]
4-
name = "multiple-crate-versions-with-dashes"
4+
# purposefully separated by - instead of _
5+
name = "multiple-crate-versions"
56
version = "0.1.0"
67
publish = false
78

0 commit comments

Comments
 (0)