Skip to content

Commit 39110be

Browse files
committed
Use one match instead of a staggered match.
1 parent e339e47 commit 39110be

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

compiler/rustc_ast/src/util/unicode.rs

+2-11
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,8 @@ pub fn contains_text_flow_control_chars(s: &str) -> bool {
2121
Some(idx) => {
2222
// bytes are valid UTF-8 -> E2 must be followed by two bytes
2323
let ch = &bytes[idx..idx + 3];
24-
match ch[1] {
25-
0x80 => {
26-
if (0xAA..=0xAE).contains(&ch[2]) {
27-
break true;
28-
}
29-
}
30-
0x81 => {
31-
if (0xA6..=0xA9).contains(&ch[2]) {
32-
break true;
33-
}
34-
}
24+
match ch {
25+
[_, 0x80, 0xAA..=0xAE] | [_, 0x81, 0xA6..=0xA9] => break true,
3526
_ => {}
3627
}
3728
bytes = &bytes[idx + 3..];

0 commit comments

Comments
 (0)