@@ -895,48 +895,44 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
895895            match  pat. kind  { 
896896                PatKind :: Binding ( _,  canonical_id,  ..)  => { 
897897                    debug ! ( "walk_pat: binding place={:?} pat={:?}" ,  place,  pat) ; 
898-                     if   let  Some ( bm )  = self 
898+                     let  bm  = self 
899899                        . cx 
900900                        . typeck_results ( ) 
901-                         . extract_binding_mode ( tcx. sess ,  pat. hir_id ,  pat. span ) 
902-                     { 
903-                         debug ! ( "walk_pat: pat.hir_id={:?} bm={:?}" ,  pat. hir_id,  bm) ; 
901+                         . extract_binding_mode ( tcx. sess ,  pat. hir_id ,  pat. span ) ; 
902+                     debug ! ( "walk_pat: pat.hir_id={:?} bm={:?}" ,  pat. hir_id,  bm) ; 
904903
905-                          // pat_ty: the type of the binding being produced. 
906-                          let  pat_ty = self . node_ty ( pat. hir_id ) ?; 
907-                          debug ! ( "walk_pat: pat_ty={:?}" ,  pat_ty) ; 
904+                     // pat_ty: the type of the binding being produced. 
905+                     let  pat_ty = self . node_ty ( pat. hir_id ) ?; 
906+                     debug ! ( "walk_pat: pat_ty={:?}" ,  pat_ty) ; 
908907
909-                         let  def = Res :: Local ( canonical_id) ; 
910-                         if  let  Ok ( ref  binding_place)  =
911-                             self . cat_res ( pat. hir_id ,  pat. span ,  pat_ty,  def) 
912-                         { 
913-                             self . delegate . borrow_mut ( ) . bind ( binding_place,  binding_place. hir_id ) ; 
914-                         } 
908+                     let  def = Res :: Local ( canonical_id) ; 
909+                     if  let  Ok ( ref  binding_place)  = self . cat_res ( pat. hir_id ,  pat. span ,  pat_ty,  def)  { 
910+                         self . delegate . borrow_mut ( ) . bind ( binding_place,  binding_place. hir_id ) ; 
911+                     } 
915912
916-                          // Subtle: MIR desugaring introduces immutable borrows for each pattern 
917-                          // binding when lowering pattern guards to ensure that the guard does not 
918-                          // modify the scrutinee. 
919-                          if  has_guard { 
920-                              self . delegate . borrow_mut ( ) . borrow ( 
921-                                  place, 
922-                                  discr_place. hir_id , 
923-                                  BorrowKind :: Immutable , 
924-                              ) ; 
925-                          } 
913+                     // Subtle: MIR desugaring introduces immutable borrows for each pattern 
914+                     // binding when lowering pattern guards to ensure that the guard does not 
915+                     // modify the scrutinee. 
916+                     if  has_guard { 
917+                         self . delegate . borrow_mut ( ) . borrow ( 
918+                             place, 
919+                             discr_place. hir_id , 
920+                             BorrowKind :: Immutable , 
921+                         ) ; 
922+                     } 
926923
927-                         // It is also a borrow or copy/move of the value being matched. 
928-                         // In a cases of pattern like `let pat = upvar`, don't use the span 
929-                         // of the pattern, as this just looks confusing, instead use the span 
930-                         // of the discriminant. 
931-                         match  bm. 0  { 
932-                             hir:: ByRef :: Yes ( m)  => { 
933-                                 let  bk = ty:: BorrowKind :: from_mutbl ( m) ; 
934-                                 self . delegate . borrow_mut ( ) . borrow ( place,  discr_place. hir_id ,  bk) ; 
935-                             } 
936-                             hir:: ByRef :: No  => { 
937-                                 debug ! ( "walk_pat binding consuming pat" ) ; 
938-                                 self . consume_or_copy ( place,  discr_place. hir_id ) ; 
939-                             } 
924+                     // It is also a borrow or copy/move of the value being matched. 
925+                     // In a cases of pattern like `let pat = upvar`, don't use the span 
926+                     // of the pattern, as this just looks confusing, instead use the span 
927+                     // of the discriminant. 
928+                     match  bm. 0  { 
929+                         hir:: ByRef :: Yes ( m)  => { 
930+                             let  bk = ty:: BorrowKind :: from_mutbl ( m) ; 
931+                             self . delegate . borrow_mut ( ) . borrow ( place,  discr_place. hir_id ,  bk) ; 
932+                         } 
933+                         hir:: ByRef :: No  => { 
934+                             debug ! ( "walk_pat binding consuming pat" ) ; 
935+                             self . consume_or_copy ( place,  discr_place. hir_id ) ; 
940936                        } 
941937                    } 
942938                } 
0 commit comments