@@ -236,11 +236,8 @@ impl<'tcx> Cx<'tcx> {
236236 fn make_mirror_unadjusted ( & mut self , expr : & ' tcx hir:: Expr < ' tcx > ) -> Expr < ' tcx > {
237237 let tcx = self . tcx ;
238238 let expr_ty = self . typeck_results ( ) . expr_ty ( expr) ;
239- let temp_lifetime = if let Some ( scope_map) = self . scope_map {
240- scope_map. temporary_scope_new ( expr. hir_id . local_id )
241- } else {
242- self . rvalue_scopes . temporary_scope ( self . region_scope_tree , expr. hir_id . local_id )
243- } ;
239+ let temp_lifetime =
240+ self . scope_map . temporary_scope ( self . rvalue_scopes , expr. hir_id . local_id ) ;
244241
245242 let kind = match expr. kind {
246243 // Here comes the interesting stuff:
@@ -717,11 +714,8 @@ impl<'tcx> Cx<'tcx> {
717714 } ,
718715 hir:: ExprKind :: Loop ( body, ..) => {
719716 let block_ty = self . typeck_results ( ) . node_type ( body. hir_id ) ;
720- let temp_lifetime = if let Some ( scope_map) = self . scope_map {
721- scope_map. temporary_scope_new ( body. hir_id . local_id )
722- } else {
723- self . rvalue_scopes . temporary_scope ( self . region_scope_tree , body. hir_id . local_id )
724- } ;
717+ let temp_lifetime =
718+ self . scope_map . temporary_scope ( self . rvalue_scopes , body. hir_id . local_id ) ;
725719 let block = self . mirror_block ( body) ;
726720 let body = self . thir . exprs . push ( Expr {
727721 ty : block_ty,
@@ -830,11 +824,8 @@ impl<'tcx> Cx<'tcx> {
830824 span : Span ,
831825 overloaded_callee : Option < Ty < ' tcx > > ,
832826 ) -> Expr < ' tcx > {
833- let temp_lifetime = if let Some ( scope_map) = self . scope_map {
834- scope_map. temporary_scope_new ( expr. hir_id . local_id )
835- } else {
836- self . rvalue_scopes . temporary_scope ( self . region_scope_tree , expr. hir_id . local_id )
837- } ;
827+ let temp_lifetime =
828+ self . scope_map . temporary_scope ( self . rvalue_scopes , expr. hir_id . local_id ) ;
838829 let ( ty, user_ty) = match overloaded_callee {
839830 Some ( fn_def) => ( fn_def, None ) ,
840831 None => {
@@ -920,11 +911,8 @@ impl<'tcx> Cx<'tcx> {
920911 // a constant reference (or constant raw pointer for `static mut`) in MIR
921912 Res :: Def ( DefKind :: Static ( _) , id) => {
922913 let ty = self . tcx . static_ptr_ty ( id) ;
923- let temp_lifetime = if let Some ( scope_map) = self . scope_map {
924- scope_map. temporary_scope_new ( expr. hir_id . local_id )
925- } else {
926- self . rvalue_scopes . temporary_scope ( self . region_scope_tree , expr. hir_id . local_id )
927- } ;
914+ let temp_lifetime =
915+ self . scope_map . temporary_scope ( self . rvalue_scopes , expr. hir_id . local_id ) ;
928916 let kind = if self . tcx . is_thread_local_static ( id) {
929917 ExprKind :: ThreadLocalRef ( id)
930918 } else {
@@ -1003,11 +991,8 @@ impl<'tcx> Cx<'tcx> {
1003991
1004992 // construct the complete expression `foo()` for the overloaded call,
1005993 // which will yield the &T type
1006- let temp_lifetime = if let Some ( scope_map) = self . scope_map {
1007- scope_map. temporary_scope_new ( expr. hir_id . local_id )
1008- } else {
1009- self . rvalue_scopes . temporary_scope ( self . region_scope_tree , expr. hir_id . local_id )
1010- } ;
994+ let temp_lifetime =
995+ self . scope_map . temporary_scope ( self . rvalue_scopes , expr. hir_id . local_id ) ;
1011996 let fun = self . method_callee ( expr, span, overloaded_callee) ;
1012997 let fun = self . thir . exprs . push ( fun) ;
1013998 let fun_ty = self . thir [ fun] . ty ;
@@ -1027,11 +1012,8 @@ impl<'tcx> Cx<'tcx> {
10271012 closure_expr : & ' tcx hir:: Expr < ' tcx > ,
10281013 place : HirPlace < ' tcx > ,
10291014 ) -> Expr < ' tcx > {
1030- let temp_lifetime = if let Some ( scope_map) = self . scope_map {
1031- scope_map. temporary_scope_new ( closure_expr. hir_id . local_id )
1032- } else {
1033- self . rvalue_scopes . temporary_scope ( self . region_scope_tree , closure_expr. hir_id . local_id )
1034- } ;
1015+ let temp_lifetime =
1016+ self . scope_map . temporary_scope ( self . rvalue_scopes , closure_expr. hir_id . local_id ) ;
10351017 let var_ty = place. base_ty ;
10361018
10371019 // The result of capture analysis in `rustc_hir_analysis/check/upvar.rs`represents a captured path
@@ -1086,11 +1068,8 @@ impl<'tcx> Cx<'tcx> {
10861068 let upvar_capture = captured_place. info . capture_kind ;
10871069 let captured_place_expr =
10881070 self . convert_captured_hir_place ( closure_expr, captured_place. place . clone ( ) ) ;
1089- let temp_lifetime = if let Some ( scope_map) = self . scope_map {
1090- scope_map. temporary_scope_new ( closure_expr. hir_id . local_id )
1091- } else {
1092- self . rvalue_scopes . temporary_scope ( self . region_scope_tree , closure_expr. hir_id . local_id )
1093- } ;
1071+ let temp_lifetime =
1072+ self . scope_map . temporary_scope ( self . rvalue_scopes , closure_expr. hir_id . local_id ) ;
10941073
10951074 match upvar_capture {
10961075 ty:: UpvarCapture :: ByValue => captured_place_expr,
0 commit comments