This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +3
-9
lines changed
crates/hir-ty/src/diagnostics Expand file tree Collapse file tree 1 file changed +3
-9
lines changed Original file line number Diff line number Diff line change @@ -109,7 +109,7 @@ impl ExprValidator {
109109 self . check_for_trailing_return ( * body_expr, & body) ;
110110 }
111111 Expr :: If { .. } => {
112- self . check_for_unnecessary_else ( id, expr, & body , db) ;
112+ self . check_for_unnecessary_else ( id, expr, db) ;
113113 }
114114 Expr :: Block { .. } => {
115115 self . validate_block ( db, expr) ;
@@ -337,18 +337,12 @@ impl ExprValidator {
337337 }
338338 }
339339
340- fn check_for_unnecessary_else (
341- & mut self ,
342- id : ExprId ,
343- expr : & Expr ,
344- body : & Body ,
345- db : & dyn HirDatabase ,
346- ) {
340+ fn check_for_unnecessary_else ( & mut self , id : ExprId , expr : & Expr , db : & dyn HirDatabase ) {
347341 if let Expr :: If { condition : _, then_branch, else_branch } = expr {
348342 if else_branch. is_none ( ) {
349343 return ;
350344 }
351- if let Expr :: Block { statements, tail, .. } = & body. exprs [ * then_branch] {
345+ if let Expr :: Block { statements, tail, .. } = & self . body . exprs [ * then_branch] {
352346 let last_then_expr = tail. or_else ( || match statements. last ( ) ? {
353347 Statement :: Expr { expr, .. } => Some ( * expr) ,
354348 _ => None ,
You can’t perform that action at this time.
0 commit comments