@@ -84,7 +84,7 @@ impl ExprValidator {
8484
8585 match expr {
8686 Expr :: Match { expr, arms } => {
87- self . validate_match ( id, * expr, arms, db, self . infer . clone ( ) ) ;
87+ self . validate_match ( id, * expr, arms, db) ;
8888 }
8989 Expr :: Call { .. } | Expr :: MethodCall { .. } => {
9090 self . validate_call ( db, id, expr, & mut filter_map_next_checker) ;
@@ -151,11 +151,10 @@ impl ExprValidator {
151151 match_expr : ExprId ,
152152 arms : & [ MatchArm ] ,
153153 db : & dyn HirDatabase ,
154- infer : Arc < InferenceResult > ,
155154 ) {
156155 let body = db. body ( self . owner ) ;
157156
158- let match_expr_ty = & infer[ match_expr] ;
157+ let match_expr_ty = & self . infer [ match_expr] ;
159158 if match_expr_ty. is_unknown ( ) {
160159 return ;
161160 }
@@ -166,7 +165,7 @@ impl ExprValidator {
166165 let mut m_arms = Vec :: with_capacity ( arms. len ( ) ) ;
167166 let mut has_lowering_errors = false ;
168167 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 ) {
170169 // We only include patterns whose type matches the type
171170 // of the match expression. If we had an InvalidMatchArmPattern
172171 // diagnostic or similar we could raise that in an else
@@ -182,7 +181,7 @@ impl ExprValidator {
182181 . as_reference ( )
183182 . map ( |( match_expr_ty, ..) | match_expr_ty == pat_ty)
184183 . unwrap_or ( false ) )
185- && types_of_subpatterns_do_match ( arm. pat , & body, & infer)
184+ && types_of_subpatterns_do_match ( arm. pat , & body, & self . infer )
186185 {
187186 // If we had a NotUsefulMatchArm diagnostic, we could
188187 // check the usefulness of each pattern as we added it
0 commit comments