@@ -84,7 +84,7 @@ impl ExprValidator {
84
84
85
85
match expr {
86
86
Expr :: Match { expr, arms } => {
87
- self . validate_match ( id, * expr, arms, db, self . infer . clone ( ) ) ;
87
+ self . validate_match ( id, * expr, arms, db) ;
88
88
}
89
89
Expr :: Call { .. } | Expr :: MethodCall { .. } => {
90
90
self . validate_call ( db, id, expr, & mut filter_map_next_checker) ;
@@ -151,11 +151,10 @@ impl ExprValidator {
151
151
match_expr : ExprId ,
152
152
arms : & [ MatchArm ] ,
153
153
db : & dyn HirDatabase ,
154
- infer : Arc < InferenceResult > ,
155
154
) {
156
155
let body = db. body ( self . owner ) ;
157
156
158
- let match_expr_ty = & infer[ match_expr] ;
157
+ let match_expr_ty = & self . infer [ match_expr] ;
159
158
if match_expr_ty. is_unknown ( ) {
160
159
return ;
161
160
}
@@ -166,7 +165,7 @@ impl ExprValidator {
166
165
let mut m_arms = Vec :: with_capacity ( arms. len ( ) ) ;
167
166
let mut has_lowering_errors = false ;
168
167
for arm in arms {
169
- if let Some ( pat_ty) = infer. type_of_pat . get ( arm. pat ) {
168
+ if let Some ( pat_ty) = self . infer . type_of_pat . get ( arm. pat ) {
170
169
// We only include patterns whose type matches the type
171
170
// of the match expression. If we had an InvalidMatchArmPattern
172
171
// diagnostic or similar we could raise that in an else
@@ -182,7 +181,7 @@ impl ExprValidator {
182
181
. as_reference ( )
183
182
. map ( |( match_expr_ty, ..) | match_expr_ty == pat_ty)
184
183
. unwrap_or ( false ) )
185
- && types_of_subpatterns_do_match ( arm. pat , & body, & infer)
184
+ && types_of_subpatterns_do_match ( arm. pat , & body, & self . infer )
186
185
{
187
186
// If we had a NotUsefulMatchArm diagnostic, we could
188
187
// check the usefulness of each pattern as we added it
0 commit comments