mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-28 02:29:44 +00:00
Merge pull request #20736 from A4-Tacks/fix-invert-if-let-chain
Fix applicable on if-let-chain for invert_if
This commit is contained in:
commit
a96d92e9e9
2 changed files with 13 additions and 4 deletions
|
|
@ -265,10 +265,7 @@ pub fn is_pattern_cond(expr: ast::Expr) -> bool {
|
|||
ast::Expr::BinExpr(expr)
|
||||
if expr.op_kind() == Some(ast::BinaryOp::LogicOp(ast::LogicOp::And)) =>
|
||||
{
|
||||
expr.lhs()
|
||||
.map(is_pattern_cond)
|
||||
.or_else(|| expr.rhs().map(is_pattern_cond))
|
||||
.unwrap_or(false)
|
||||
expr.lhs().map_or(false, is_pattern_cond) || expr.rhs().map_or(false, is_pattern_cond)
|
||||
}
|
||||
ast::Expr::ParenExpr(expr) => expr.expr().is_some_and(is_pattern_cond),
|
||||
ast::Expr::LetExpr(_) => true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue