@@ -113,7 +113,7 @@ impl PatCtxt<'_, '_> {
113113}
114114
115115impl < ' tcx > MatchVisitor < ' _ , ' tcx > {
116- fn check_patterns ( & mut self , pat : & Pat < ' _ > ) {
116+ fn check_patterns ( & self , pat : & Pat < ' _ > ) {
117117 pat. walk_always ( |pat| check_borrow_conflicts_in_at_patterns ( self , pat) ) ;
118118 if !self . tcx . features ( ) . bindings_after_at {
119119 check_legality_of_bindings_in_at_patterns ( self , pat) ;
@@ -154,18 +154,13 @@ impl<'tcx> MatchVisitor<'_, 'tcx> {
154154 arms : & ' tcx [ hir:: Arm < ' tcx > ] ,
155155 source : hir:: MatchSource ,
156156 ) {
157+ let mut cx = self . new_cx ( scrut. hir_id ) ;
158+
157159 for arm in arms {
158160 // Check the arm for some things unrelated to exhaustiveness.
159161 self . check_patterns ( & arm. pat ) ;
160162 if let Some ( hir:: Guard :: IfLet ( ref pat, _) ) = arm. guard {
161163 self . check_patterns ( pat) ;
162- }
163- }
164-
165- let mut cx = self . new_cx ( scrut. hir_id ) ;
166-
167- for arm in arms {
168- if let Some ( hir:: Guard :: IfLet ( ref pat, _) ) = arm. guard {
169164 let tpat = self . lower_pattern ( & mut cx, pat, & mut false ) . 0 ;
170165 check_if_let_guard ( & mut cx, & tpat, pat. hir_id ) ;
171166 }
0 commit comments