about summary refs log tree commit diff
diff options
context:
space:
mode:
authorKristof Mattei <864376+Kristof-Mattei@users.noreply.github.com>2024-01-14 14:00:13 -0700
committerKristof Mattei <864376+Kristof-Mattei@users.noreply.github.com>2024-01-14 14:00:13 -0700
commite8ec99811b80372012d3ece0e0f31f5722785eec (patch)
treed5a8b85283779d6e8614aa2fcf493d98e3717e17
parentea585ef321b6ba63635984772fe576e6a4e461fc (diff)
downloadrust-e8ec99811b80372012d3ece0e0f31f5722785eec.tar.gz
rust-e8ec99811b80372012d3ece0e0f31f5722785eec.zip
fix: crates are limited to ASCII values
-rw-r--r--clippy_lints/src/cargo/multiple_crate_versions.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/clippy_lints/src/cargo/multiple_crate_versions.rs b/clippy_lints/src/cargo/multiple_crate_versions.rs
index 6b4af6753c3..57b7b7497fe 100644
--- a/clippy_lints/src/cargo/multiple_crate_versions.rs
+++ b/clippy_lints/src/cargo/multiple_crate_versions.rs
@@ -20,9 +20,10 @@ pub(super) fn check(cx: &LateContext<'_>, metadata: &Metadata) {
             // local_name contains the crate name as a namespace, with the dashes converted to underscores
             // the code below temporarily rectifies this discrepancy
             if p.name
-                .chars()
-                .map(|c| if c == '-' { '_' } else { c })
-                .eq(local_name.as_str().chars())
+                .as_bytes()
+                .iter()
+                .map(|b| if b == &b'-' { &b'_' } else { b })
+                .eq(local_name.as_str().as_bytes())
             {
                 Some(&p.id)
             } else {