@@ -89,21 +89,19 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
8989 let ( _, source_map) = db. body_with_source_map ( self . func . into ( ) ) ;
9090
9191 if let Ok ( source_ptr) = source_map. expr_syntax ( id) {
92- if let Some ( expr) = source_ptr. value . as_ref ( ) . left ( ) {
93- let root = source_ptr. file_syntax ( db. upcast ( ) ) ;
94- if let ast:: Expr :: RecordLit ( record_lit) = expr. to_node ( & root) {
95- if let Some ( field_list) = record_lit. record_field_list ( ) {
96- let variant_data = variant_data ( db. upcast ( ) , variant_def) ;
97- let missed_fields = missed_fields
98- . into_iter ( )
99- . map ( |idx| variant_data. fields ( ) [ idx] . name . clone ( ) )
100- . collect ( ) ;
101- self . sink . push ( MissingFields {
102- file : source_ptr. file_id ,
103- field_list : AstPtr :: new ( & field_list) ,
104- missed_fields,
105- } )
106- }
92+ let root = source_ptr. file_syntax ( db. upcast ( ) ) ;
93+ if let ast:: Expr :: RecordLit ( record_lit) = & source_ptr. value . to_node ( & root) {
94+ if let Some ( field_list) = record_lit. record_field_list ( ) {
95+ let variant_data = variant_data ( db. upcast ( ) , variant_def) ;
96+ let missed_fields = missed_fields
97+ . into_iter ( )
98+ . map ( |idx| variant_data. fields ( ) [ idx] . name . clone ( ) )
99+ . collect ( ) ;
100+ self . sink . push ( MissingFields {
101+ file : source_ptr. file_id ,
102+ field_list : AstPtr :: new ( & field_list) ,
103+ missed_fields,
104+ } )
107105 }
108106 }
109107 }
@@ -205,18 +203,16 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
205203 }
206204
207205 if let Ok ( source_ptr) = source_map. expr_syntax ( id) {
208- if let Some ( expr) = source_ptr. value . as_ref ( ) . left ( ) {
209- let root = source_ptr. file_syntax ( db. upcast ( ) ) ;
210- if let ast:: Expr :: MatchExpr ( match_expr) = expr. to_node ( & root) {
211- if let ( Some ( match_expr) , Some ( arms) ) =
212- ( match_expr. expr ( ) , match_expr. match_arm_list ( ) )
213- {
214- self . sink . push ( MissingMatchArms {
215- file : source_ptr. file_id ,
216- match_expr : AstPtr :: new ( & match_expr) ,
217- arms : AstPtr :: new ( & arms) ,
218- } )
219- }
206+ let root = source_ptr. file_syntax ( db. upcast ( ) ) ;
207+ if let ast:: Expr :: MatchExpr ( match_expr) = & source_ptr. value . to_node ( & root) {
208+ if let ( Some ( match_expr) , Some ( arms) ) =
209+ ( match_expr. expr ( ) , match_expr. match_arm_list ( ) )
210+ {
211+ self . sink . push ( MissingMatchArms {
212+ file : source_ptr. file_id ,
213+ match_expr : AstPtr :: new ( & match_expr) ,
214+ arms : AstPtr :: new ( & arms) ,
215+ } )
220216 }
221217 }
222218 }
@@ -247,9 +243,8 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
247243 let ( _, source_map) = db. body_with_source_map ( self . func . into ( ) ) ;
248244
249245 if let Ok ( source_ptr) = source_map. expr_syntax ( id) {
250- if let Some ( expr) = source_ptr. value . left ( ) {
251- self . sink . push ( MissingOkInTailExpr { file : source_ptr. file_id , expr } ) ;
252- }
246+ self . sink
247+ . push ( MissingOkInTailExpr { file : source_ptr. file_id , expr : source_ptr. value } ) ;
253248 }
254249 }
255250 }
0 commit comments