@@ -384,12 +384,11 @@ fn cooked_string(mut input: Cursor) -> Result<Cursor, Reject> {
384
384
Some ( ( _, 'x' ) ) => {
385
385
backslash_x_char ( & mut chars) ?;
386
386
}
387
- Some ( ( _, 'n' ) ) | Some ( ( _, 'r' ) ) | Some ( ( _, 't' ) ) | Some ( ( _, '\\' ) )
388
- | Some ( ( _, '\'' ) ) | Some ( ( _, '"' ) ) | Some ( ( _, '0' ) ) => { }
387
+ Some ( ( _, 'n' | 'r' | 't' | '\\' | '\'' | '"' | '0' ) ) => { }
389
388
Some ( ( _, 'u' ) ) => {
390
389
backslash_u ( & mut chars) ?;
391
390
}
392
- Some ( ( newline, ch @ '\n' ) ) | Some ( ( newline , ch @ '\r' ) ) => {
391
+ Some ( ( newline, ch @ ( '\n' | '\r' ) ) ) => {
393
392
input = input. advance ( newline + 1 ) ;
394
393
trailing_backslash ( & mut input, ch as u8 ) ?;
395
394
chars = input. char_indices ( ) ;
@@ -447,9 +446,8 @@ fn cooked_byte_string(mut input: Cursor) -> Result<Cursor, Reject> {
447
446
Some ( ( _, b'x' ) ) => {
448
447
backslash_x_byte ( & mut bytes) ?;
449
448
}
450
- Some ( ( _, b'n' ) ) | Some ( ( _, b'r' ) ) | Some ( ( _, b't' ) ) | Some ( ( _, b'\\' ) )
451
- | Some ( ( _, b'0' ) ) | Some ( ( _, b'\'' ) ) | Some ( ( _, b'"' ) ) => { }
452
- Some ( ( newline, b @ b'\n' ) ) | Some ( ( newline, b @ b'\r' ) ) => {
449
+ Some ( ( _, b'n' | b'r' | b't' | b'\\' | b'0' | b'\'' | b'"' ) ) => { }
450
+ Some ( ( newline, b @ ( b'\n' | b'\r' ) ) ) => {
453
451
input = input. advance ( newline + 1 ) ;
454
452
trailing_backslash ( & mut input, b) ?;
455
453
bytes = input. bytes ( ) . enumerate ( ) ;
@@ -550,14 +548,13 @@ fn cooked_c_string(mut input: Cursor) -> Result<Cursor, Reject> {
550
548
Some ( ( _, 'x' ) ) => {
551
549
backslash_x_nonzero ( & mut chars) ?;
552
550
}
553
- Some ( ( _, 'n' ) ) | Some ( ( _, 'r' ) ) | Some ( ( _, 't' ) ) | Some ( ( _, '\\' ) )
554
- | Some ( ( _, '\'' ) ) | Some ( ( _, '"' ) ) => { }
551
+ Some ( ( _, 'n' | 'r' | 't' | '\\' | '\'' | '"' ) ) => { }
555
552
Some ( ( _, 'u' ) ) => {
556
553
if backslash_u ( & mut chars) ? == '\0' {
557
554
break ;
558
555
}
559
556
}
560
- Some ( ( newline, ch @ '\n' ) ) | Some ( ( newline , ch @ '\r' ) ) => {
557
+ Some ( ( newline, ch @ ( '\n' | '\r' ) ) ) => {
561
558
input = input. advance ( newline + 1 ) ;
562
559
trailing_backslash ( & mut input, ch as u8 ) ?;
563
560
chars = input. char_indices ( ) ;
@@ -577,8 +574,7 @@ fn byte(input: Cursor) -> Result<Cursor, Reject> {
577
574
let ok = match bytes. next ( ) . map ( |( _, b) | b) {
578
575
Some ( b'\\' ) => match bytes. next ( ) . map ( |( _, b) | b) {
579
576
Some ( b'x' ) => backslash_x_byte ( & mut bytes) . is_ok ( ) ,
580
- Some ( b'n' ) | Some ( b'r' ) | Some ( b't' ) | Some ( b'\\' ) | Some ( b'0' ) | Some ( b'\'' )
581
- | Some ( b'"' ) => true ,
577
+ Some ( b'n' | b'r' | b't' | b'\\' | b'0' | b'\'' | b'"' ) => true ,
582
578
_ => false ,
583
579
} ,
584
580
b => b. is_some ( ) ,
@@ -601,9 +597,7 @@ fn character(input: Cursor) -> Result<Cursor, Reject> {
601
597
Some ( '\\' ) => match chars. next ( ) . map ( |( _, ch) | ch) {
602
598
Some ( 'x' ) => backslash_x_char ( & mut chars) . is_ok ( ) ,
603
599
Some ( 'u' ) => backslash_u ( & mut chars) . is_ok ( ) ,
604
- Some ( 'n' ) | Some ( 'r' ) | Some ( 't' ) | Some ( '\\' ) | Some ( '0' ) | Some ( '\'' ) | Some ( '"' ) => {
605
- true
606
- }
600
+ Some ( 'n' | 'r' | 't' | '\\' | '0' | '\'' | '"' ) => true ,
607
601
_ => false ,
608
602
} ,
609
603
ch => ch. is_some ( ) ,
@@ -692,8 +686,7 @@ fn trailing_backslash(input: &mut Cursor, mut last: u8) -> Result<(), Reject> {
692
686
return Err ( Reject ) ;
693
687
}
694
688
match whitespace. next ( ) {
695
- Some ( ( _, b @ b' ' ) ) | Some ( ( _, b @ b'\t' ) ) | Some ( ( _, b @ b'\n' ) )
696
- | Some ( ( _, b @ b'\r' ) ) => {
689
+ Some ( ( _, b @ ( b' ' | b'\t' | b'\n' | b'\r' ) ) ) => {
697
690
last = b;
698
691
}
699
692
Some ( ( offset, _) ) => {
0 commit comments