Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/diagnostics/expr.rs')
-rw-r--r--crates/hir-ty/src/diagnostics/expr.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/crates/hir-ty/src/diagnostics/expr.rs b/crates/hir-ty/src/diagnostics/expr.rs
index af3ca3c082..50312af4f2 100644
--- a/crates/hir-ty/src/diagnostics/expr.rs
+++ b/crates/hir-ty/src/diagnostics/expr.rs
@@ -266,6 +266,12 @@ impl ExprValidator {
self.check_for_trailing_return(last_stmt, body);
}
}
+ Expr::If { then_branch, else_branch, .. } => {
+ self.check_for_trailing_return(*then_branch, body);
+ if let Some(else_branch) = else_branch {
+ self.check_for_trailing_return(*else_branch, body);
+ }
+ }
Expr::Return { .. } => {
self.diagnostics.push(BodyValidationDiagnostic::RemoveTrailingReturn {
return_expr: body_expr,