@@ -324,7 +324,7 @@ def process_nesting_level
324
324
when 'def' , 'case' , 'for' , 'begin' , 'class' , 'module'
325
325
indent += 1
326
326
when 'if' , 'unless' , 'while' , 'until'
327
- # postfix if/unless/while/until/rescue must be Ripper::EXPR_LABEL
327
+ # postfix if/unless/while/until must be Ripper::EXPR_LABEL
328
328
indent += 1 unless t [ 3 ] . allbits? ( Ripper ::EXPR_LABEL )
329
329
when 'end'
330
330
indent -= 1
@@ -369,12 +369,12 @@ def check_newline_depth_difference
369
369
end
370
370
when 'def' , 'case' , 'for' , 'begin' , 'class' , 'module'
371
371
depth_difference += 1
372
- when 'if' , 'unless' , 'while' , 'until'
372
+ when 'if' , 'unless' , 'while' , 'until' , 'rescue'
373
373
# postfix if/unless/while/until/rescue must be Ripper::EXPR_LABEL
374
374
unless t [ 3 ] . allbits? ( Ripper ::EXPR_LABEL )
375
375
depth_difference += 1
376
376
end
377
- when 'else' , 'elsif' , 'rescue' , ' ensure', 'when' , 'in'
377
+ when 'else' , 'elsif' , 'ensure' , 'when' , 'in'
378
378
depth_difference += 1
379
379
end
380
380
end
@@ -420,12 +420,16 @@ def check_corresponding_token_depth
420
420
case t [ 2 ]
421
421
when 'def' , 'do' , 'case' , 'for' , 'begin' , 'class' , 'module'
422
422
spaces_of_nest . push ( spaces_at_line_head )
423
+ when 'rescue'
424
+ unless t [ 3 ] . allbits? ( Ripper ::EXPR_LABEL )
425
+ corresponding_token_depth = spaces_of_nest . last
426
+ end
423
427
when 'if' , 'unless' , 'while' , 'until'
424
- # postfix if/unless/while/until/rescue must be Ripper::EXPR_LABEL
428
+ # postfix if/unless/while/until must be Ripper::EXPR_LABEL
425
429
unless t [ 3 ] . allbits? ( Ripper ::EXPR_LABEL )
426
430
spaces_of_nest . push ( spaces_at_line_head )
427
431
end
428
- when 'else' , 'elsif' , 'rescue' , ' ensure', 'when' , 'in'
432
+ when 'else' , 'elsif' , 'ensure' , 'when' , 'in'
429
433
corresponding_token_depth = spaces_of_nest . last
430
434
when 'end'
431
435
if is_first_printable_of_line
0 commit comments