Skip to content

Commit

Permalink
Create subslice as that leads to a smaller code size.
Browse files Browse the repository at this point in the history
  • Loading branch information
hkratz committed Nov 4, 2021
1 parent 2d9f0e2 commit a5b25a2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions compiler/rustc_parse/src/lexer/mod.rs
Expand Up @@ -153,14 +153,15 @@ impl<'a> StringReader<'a> {
match core::slice::memchr::memchr(0xE2, &bytes) {
Some(idx) => {
// bytes are valid UTF-8 -> E2 must be followed by two bytes
match bytes[idx + 1] {
let ch = &bytes[idx..idx + 3];
match ch[1] {
0x80 => {
if (0xAA..=0xAE).contains(&bytes[idx + 2]) {
if (0xAA..=0xAE).contains(&ch[2]) {
break true;
}
}
0x81 => {
if (0xA6..=0xA9).contains(&bytes[idx + 2]) {
if (0xA6..=0xA9).contains(&ch[2]) {
break true;
}
}
Expand Down

0 comments on commit a5b25a2

Please sign in to comment.