Skip to content

Commit 5b64827

Browse files
committed
legacy: iterate over bytes, not chars, as mangled string ascii only; fix clippy
1 parent 20f6396 commit 5b64827

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/legacy.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ pub fn demangle(s: &str) -> Result<(Demangle<'_>, &str), ()> {
9999

100100
// Rust hashes are hex digits with an `h` prepended.
101101
fn is_rust_hash(s: &str) -> bool {
102-
s.starts_with('h') && s[1..].chars().all(|c| c.is_digit(16))
102+
s.starts_with('h') && s[1..].bytes().all(|c| (c as char).is_digit(16))
103103
}
104104

105105
impl<'a> fmt::Display for Demangle<'a> {
@@ -116,7 +116,7 @@ impl<'a> fmt::Display for Demangle<'a> {
116116
rest = &rest[..i];
117117
// Skip printing the hash if alternate formatting
118118
// was requested.
119-
if f.alternate() && element + 1 == self.elements && is_rust_hash(&rest) {
119+
if f.alternate() && element + 1 == self.elements && is_rust_hash(rest) {
120120
break;
121121
}
122122
if element != 0 {

0 commit comments

Comments
 (0)