Fix more cases of when in guard

This commit is contained in:
Joshua Warner 2025-01-11 10:06:05 -08:00
parent 903b792fd3
commit 6b08f42d02
No known key found for this signature in database
GPG key ID: 89AD497003F93FDD
5 changed files with 99 additions and 0 deletions

View file

@ -1779,6 +1779,8 @@ fn guard_needs_parens(value: &Expr<'_>) -> bool {
Expr::ParensAround(expr) | Expr::SpaceBefore(expr, _) | Expr::SpaceAfter(expr, _) => {
guard_needs_parens(expr)
}
Expr::Closure(_, body) => guard_needs_parens(&body.value),
Expr::Defs(_, final_expr) => guard_needs_parens(&final_expr.value),
_ => false,
}
}