@@ -82,11 +82,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
82
82
this. lower_expr_while_in_loop_scope ( e. span , cond, body, opt_label)
83
83
} ) ,
84
84
ExprKind :: Loop ( ref body, opt_label) => self . with_loop_scope ( e. id , |this| {
85
- hir:: ExprKind :: Loop (
86
- this. lower_block ( body, false ) ,
87
- this. lower_label ( opt_label) ,
88
- hir:: LoopSource :: Loop ,
89
- )
85
+ hir:: ExprKind :: Loop ( this. lower_block ( body, false ) , opt_label, hir:: LoopSource :: Loop )
90
86
} ) ,
91
87
ExprKind :: TryBlock ( ref body) => self . lower_expr_try_block ( body) ,
92
88
ExprKind :: Match ( ref expr, ref arms) => hir:: ExprKind :: Match (
@@ -123,10 +119,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
123
119
self . lower_expr_closure ( capture_clause, movability, decl, body, fn_decl_span)
124
120
}
125
121
}
126
- ExprKind :: Block ( ref blk, opt_label) => hir:: ExprKind :: Block (
127
- self . lower_block ( blk, opt_label. is_some ( ) ) ,
128
- self . lower_label ( opt_label) ,
129
- ) ,
122
+ ExprKind :: Block ( ref blk, opt_label) => {
123
+ hir:: ExprKind :: Block ( self . lower_block ( blk, opt_label. is_some ( ) ) , opt_label)
124
+ }
130
125
ExprKind :: Assign ( ref el, ref er, span) => {
131
126
hir:: ExprKind :: Assign ( self . lower_expr ( el) , self . lower_expr ( er) , span)
132
127
}
@@ -407,11 +402,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
407
402
) ;
408
403
409
404
// `[opt_ident]: loop { ... }`
410
- hir:: ExprKind :: Loop (
411
- self . block_expr ( self . arena . alloc ( match_expr) ) ,
412
- self . lower_label ( opt_label) ,
413
- source,
414
- )
405
+ hir:: ExprKind :: Loop ( self . block_expr ( self . arena . alloc ( match_expr) ) , opt_label, source)
415
406
}
416
407
417
408
/// Desugar `try { <stmts>; <expr> }` into `{ <stmts>; ::std::ops::Try::from_ok(<expr>) }`,
@@ -836,10 +827,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
836
827
}
837
828
}
838
829
839
- fn lower_label ( & mut self , label : Option < Label > ) -> Option < Label > {
840
- label. map ( |label| Label { ident : label. ident } )
841
- }
842
-
843
830
fn lower_loop_destination ( & mut self , destination : Option < ( NodeId , Label ) > ) -> hir:: Destination {
844
831
let target_id = match destination {
845
832
Some ( ( id, _) ) => {
@@ -857,7 +844,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
857
844
. unwrap_or ( Err ( hir:: LoopIdError :: OutsideLoopScope ) )
858
845
. into ( ) ,
859
846
} ;
860
- hir:: Destination { label : self . lower_label ( destination. map ( |( _, label) | label) ) , target_id }
847
+ hir:: Destination { label : destination. map ( |( _, label) | label) , target_id }
861
848
}
862
849
863
850
fn lower_jump_destination ( & mut self , id : NodeId , opt_label : Option < Label > ) -> hir:: Destination {
@@ -1100,8 +1087,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
1100
1087
) ;
1101
1088
1102
1089
// `[opt_ident]: loop { ... }`
1103
- let kind =
1104
- hir:: ExprKind :: Loop ( loop_block, self . lower_label ( opt_label) , hir:: LoopSource :: ForLoop ) ;
1090
+ let kind = hir:: ExprKind :: Loop ( loop_block, opt_label, hir:: LoopSource :: ForLoop ) ;
1105
1091
let loop_expr = self . arena . alloc ( hir:: Expr {
1106
1092
hir_id : self . lower_node_id ( e. id ) ,
1107
1093
kind,
0 commit comments