mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
remove trailing return in trailing if expression
This commit is contained in:
parent
2987fac76f
commit
cad222ff1b
2 changed files with 66 additions and 0 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue