@@ -3231,18 +3231,8 @@ impl<'a> Parser<'a> {
3231
3231
return Err ( err)
3232
3232
}
3233
3233
let not_block = self . token != token:: OpenDelim ( token:: Brace ) ;
3234
- let fat_arrow_sp = if self . token == token:: FatArrow {
3235
- Some ( self . span )
3236
- } else {
3237
- None
3238
- } ;
3239
3234
let thn = self . parse_block ( ) . map_err ( |mut err| {
3240
- if let Some ( sp) = fat_arrow_sp {
3241
- // if cond => expr
3242
- err. span_suggestion ( sp,
3243
- "only necessary in match arms, not before if blocks" ,
3244
- "" . to_string ( ) ) ;
3245
- } else if not_block {
3235
+ if not_block {
3246
3236
err. span_label ( lo, "this `if` statement has a condition, but no block" ) ;
3247
3237
}
3248
3238
err
@@ -3444,7 +3434,7 @@ impl<'a> Parser<'a> {
3444
3434
3445
3435
let expr = self . parse_expr_res ( Restrictions :: STMT_EXPR , None )
3446
3436
. map_err ( |mut err| {
3447
- err. span_label ( arrow_span, "while parsing the match arm starting here" ) ;
3437
+ err. span_label ( arrow_span, "while parsing the ` match` arm starting here" ) ;
3448
3438
err
3449
3439
} ) ?;
3450
3440
@@ -3455,7 +3445,6 @@ impl<'a> Parser<'a> {
3455
3445
let cm = self . sess . codemap ( ) ;
3456
3446
self . expect_one_of ( & [ token:: Comma ] , & [ token:: CloseDelim ( token:: Brace ) ] )
3457
3447
. map_err ( |mut err| {
3458
- err. span_label ( arrow_span, "while parsing the match arm starting here" ) ;
3459
3448
match ( cm. span_to_lines ( expr. span ) , cm. span_to_lines ( arm_start_span) ) {
3460
3449
( Ok ( ref expr_lines) , Ok ( ref arm_start_lines) )
3461
3450
if arm_start_lines. lines [ 0 ] . end_col == expr_lines. lines [ 0 ] . end_col
@@ -3472,11 +3461,16 @@ impl<'a> Parser<'a> {
3472
3461
// | - ^^ self.span
3473
3462
// | |
3474
3463
// | parsed until here as `"y" & X`
3475
- err. span_suggestion_short ( cm. next_point ( arm_start_span) ,
3476
- "missing a comma here to end this match arm" ,
3477
- "," . to_owned ( ) ) ;
3464
+ err. span_suggestion_short (
3465
+ cm. next_point ( arm_start_span) ,
3466
+ "missing a comma here to end this `match` arm" ,
3467
+ "," . to_owned ( )
3468
+ ) ;
3469
+ }
3470
+ _ => {
3471
+ err. span_label ( arrow_span,
3472
+ "while parsing the `match` arm starting here" ) ;
3478
3473
}
3479
- _ => { }
3480
3474
}
3481
3475
err
3482
3476
} ) ?;
0 commit comments