File tree 1 file changed +12
-19
lines changed
1 file changed +12
-19
lines changed Original file line number Diff line number Diff line change @@ -340,13 +340,10 @@ fn cooked_string(input: Cursor) -> Result<Cursor, LexError> {
340
340
let input = input. advance ( i + 1 ) ;
341
341
return Ok ( literal_suffix ( input) ) ;
342
342
}
343
- '\r' => {
344
- if let Some ( ( _, '\n' ) ) = chars. next ( ) {
345
- // ...
346
- } else {
347
- break ;
348
- }
349
- }
343
+ '\r' => match chars. next ( ) {
344
+ Some ( ( _, '\n' ) ) => { }
345
+ _ => break ,
346
+ } ,
350
347
'\\' => match chars. next ( ) {
351
348
Some ( ( _, 'x' ) ) => {
352
349
if !backslash_x_char ( & mut chars) {
@@ -401,13 +398,10 @@ fn cooked_byte_string(mut input: Cursor) -> Result<Cursor, LexError> {
401
398
let input = input. advance ( offset + 1 ) ;
402
399
return Ok ( literal_suffix ( input) ) ;
403
400
}
404
- b'\r' => {
405
- if let Some ( ( _, b'\n' ) ) = bytes. next ( ) {
406
- // ...
407
- } else {
408
- break ;
409
- }
410
- }
401
+ b'\r' => match bytes. next ( ) {
402
+ Some ( ( _, b'\n' ) ) => { }
403
+ _ => break ,
404
+ } ,
411
405
b'\\' => match bytes. next ( ) {
412
406
Some ( ( _, b'x' ) ) => {
413
407
if !backslash_x_byte ( & mut bytes) {
@@ -463,11 +457,10 @@ fn raw_string(input: Cursor) -> Result<Cursor, LexError> {
463
457
let rest = input. advance ( i + 1 + n) ;
464
458
return Ok ( literal_suffix ( rest) ) ;
465
459
}
466
- '\r' => {
467
- if chars. next ( ) . map_or ( true , |( _, ch) | ch != '\n' ) {
468
- return Err ( LexError ) ;
469
- }
470
- }
460
+ '\r' => match chars. next ( ) {
461
+ Some ( ( _, '\n' ) ) => { }
462
+ _ => break ,
463
+ } ,
471
464
_ => { }
472
465
}
473
466
}
You can’t perform that action at this time.
0 commit comments