Use one match instead of a staggered match.
This commit is contained in:
parent
e339e4789f
commit
39110beab0
1 changed files with 2 additions and 11 deletions
|
@ -21,17 +21,8 @@ pub fn contains_text_flow_control_chars(s: &str) -> bool {
|
||||||
Some(idx) => {
|
Some(idx) => {
|
||||||
// bytes are valid UTF-8 -> E2 must be followed by two bytes
|
// bytes are valid UTF-8 -> E2 must be followed by two bytes
|
||||||
let ch = &bytes[idx..idx + 3];
|
let ch = &bytes[idx..idx + 3];
|
||||||
match ch[1] {
|
match ch {
|
||||||
0x80 => {
|
[_, 0x80, 0xAA..=0xAE] | [_, 0x81, 0xA6..=0xA9] => break true,
|
||||||
if (0xAA..=0xAE).contains(&ch[2]) {
|
|
||||||
break true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
0x81 => {
|
|
||||||
if (0xA6..=0xA9).contains(&ch[2]) {
|
|
||||||
break true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
bytes = &bytes[idx + 3..];
|
bytes = &bytes[idx + 3..];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue