Skip to content

Commit 6c3882c

Browse files
committed
legacy: get switch all chars iterators to bytes
1 parent 8c0ddca commit 6c3882c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/legacy.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,12 @@ impl<'a> fmt::Display for Demangle<'a> {
113113
let mut inner = self.inner;
114114
for element in 0..self.elements {
115115
let mut rest = inner;
116-
while rest.chars().next().unwrap().is_digit(10) {
116+
while rest
117+
.bytes()
118+
.next()
119+
.map(|c| (c as char).is_digit(10))
120+
.unwrap_or(false)
121+
{
117122
rest = &rest[1..];
118123
}
119124
let i: usize = inner[..(inner.len() - rest.len())].parse().unwrap();
@@ -132,7 +137,7 @@ impl<'a> fmt::Display for Demangle<'a> {
132137
}
133138
loop {
134139
if rest.starts_with('.') {
135-
if let Some('.') = rest[1..].chars().next() {
140+
if let Some(b'.') = rest[1..].bytes().next() {
136141
f.write_str("::")?;
137142
rest = &rest[2..];
138143
} else {

0 commit comments

Comments
 (0)