1
Fork 0

Use one match instead of a staggered match.

This commit is contained in:
Hans Kratz 2021-11-05 00:39:34 +01:00
parent e339e4789f
commit 39110beab0

View file

@ -21,17 +21,8 @@ pub fn contains_text_flow_control_chars(s: &str) -> bool {
Some(idx) => {
// bytes are valid UTF-8 -> E2 must be followed by two bytes
let ch = &bytes[idx..idx + 3];
match ch[1] {
0x80 => {
if (0xAA..=0xAE).contains(&ch[2]) {
break true;
}
}
0x81 => {
if (0xA6..=0xA9).contains(&ch[2]) {
break true;
}
}
match ch {
[_, 0x80, 0xAA..=0xAE] | [_, 0x81, 0xA6..=0xA9] => break true,
_ => {}
}
bytes = &bytes[idx + 3..];