File tree 1 file changed +3
-9
lines changed
crates/hir-ty/src/diagnostics
1 file changed +3
-9
lines changed Original file line number Diff line number Diff line change @@ -109,7 +109,7 @@ impl ExprValidator {
109
109
self . check_for_trailing_return ( * body_expr, & body) ;
110
110
}
111
111
Expr :: If { .. } => {
112
- self . check_for_unnecessary_else ( id, expr, & body , db) ;
112
+ self . check_for_unnecessary_else ( id, expr, db) ;
113
113
}
114
114
Expr :: Block { .. } => {
115
115
self . validate_block ( db, expr) ;
@@ -337,18 +337,12 @@ impl ExprValidator {
337
337
}
338
338
}
339
339
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 ) {
347
341
if let Expr :: If { condition : _, then_branch, else_branch } = expr {
348
342
if else_branch. is_none ( ) {
349
343
return ;
350
344
}
351
- if let Expr :: Block { statements, tail, .. } = & body. exprs [ * then_branch] {
345
+ if let Expr :: Block { statements, tail, .. } = & self . body . exprs [ * then_branch] {
352
346
let last_then_expr = tail. or_else ( || match statements. last ( ) ? {
353
347
Statement :: Expr { expr, .. } => Some ( * expr) ,
354
348
_ => None ,
You can’t perform that action at this time.
0 commit comments