@@ -113,7 +113,7 @@ impl PatCtxt<'_, '_> {
113
113
}
114
114
115
115
impl < ' tcx > MatchVisitor < ' _ , ' tcx > {
116
- fn check_patterns ( & mut self , pat : & Pat < ' _ > ) {
116
+ fn check_patterns ( & self , pat : & Pat < ' _ > ) {
117
117
pat. walk_always ( |pat| check_borrow_conflicts_in_at_patterns ( self , pat) ) ;
118
118
if !self . tcx . features ( ) . bindings_after_at {
119
119
check_legality_of_bindings_in_at_patterns ( self , pat) ;
@@ -154,18 +154,13 @@ impl<'tcx> MatchVisitor<'_, 'tcx> {
154
154
arms : & ' tcx [ hir:: Arm < ' tcx > ] ,
155
155
source : hir:: MatchSource ,
156
156
) {
157
+ let mut cx = self . new_cx ( scrut. hir_id ) ;
158
+
157
159
for arm in arms {
158
160
// Check the arm for some things unrelated to exhaustiveness.
159
161
self . check_patterns ( & arm. pat ) ;
160
162
if let Some ( hir:: Guard :: IfLet ( ref pat, _) ) = arm. guard {
161
163
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 {
169
164
let tpat = self . lower_pattern ( & mut cx, pat, & mut false ) . 0 ;
170
165
check_if_let_guard ( & mut cx, & tpat, pat. hir_id ) ;
171
166
}
0 commit comments