We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d4feb08 commit 7089355Copy full SHA for 7089355
compiler/rustc_lexer/src/unescape.rs
@@ -391,16 +391,15 @@ where
391
let mut spaces = 0;
392
let mut contains_nl = false;
393
394
- for byte in chars.as_str().bytes() {
395
- match byte {
396
- b' ' | b'\t' | b'\r' => {
397
- spaces += 1;
398
- }
399
- b'\n' => {
400
401
- contains_nl = true;
402
403
- _ => break,
+ for &byte in chars.as_str().bytes() {
+ let is_space = matches!(byte, b' ' | b'\t' | b'\r' | b'\n');
+ let is_newline = byte == b'\n';
+
+ spaces += is_space as usize;
+ contains_nl |= is_newline;
+ if !is_space {
+ break;
404
}
405
406
*chars = chars.as_str()[spaces..].chars();
0 commit comments