From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- src/tools/clippy/tests/ui/author/if.stdout | 50 ++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 src/tools/clippy/tests/ui/author/if.stdout (limited to 'src/tools/clippy/tests/ui/author/if.stdout') diff --git a/src/tools/clippy/tests/ui/author/if.stdout b/src/tools/clippy/tests/ui/author/if.stdout new file mode 100644 index 000000000..8d92849b3 --- /dev/null +++ b/src/tools/clippy/tests/ui/author/if.stdout @@ -0,0 +1,50 @@ +if_chain! { + if let StmtKind::Local(local) = stmt.kind; + if let Some(init) = local.init; + if let ExprKind::If(cond, then, Some(else_expr)) = init.kind; + if let ExprKind::DropTemps(expr) = cond.kind; + if let ExprKind::Lit(ref lit) = expr.kind; + if let LitKind::Bool(true) = lit.node; + if let ExprKind::Block(block, None) = then.kind; + if block.stmts.len() == 1; + if let StmtKind::Semi(e) = block.stmts[0].kind; + if let ExprKind::Binary(op, left, right) = e.kind; + if BinOpKind::Eq == op.node; + if let ExprKind::Lit(ref lit1) = left.kind; + if let LitKind::Int(1, LitIntType::Unsuffixed) = lit1.node; + if let ExprKind::Lit(ref lit2) = right.kind; + if let LitKind::Int(1, LitIntType::Unsuffixed) = lit2.node; + if block.expr.is_none(); + if let ExprKind::Block(block1, None) = else_expr.kind; + if block1.stmts.len() == 1; + if let StmtKind::Semi(e1) = block1.stmts[0].kind; + if let ExprKind::Binary(op1, left1, right1) = e1.kind; + if BinOpKind::Eq == op1.node; + if let ExprKind::Lit(ref lit3) = left1.kind; + if let LitKind::Int(2, LitIntType::Unsuffixed) = lit3.node; + if let ExprKind::Lit(ref lit4) = right1.kind; + if let LitKind::Int(2, LitIntType::Unsuffixed) = lit4.node; + if block1.expr.is_none(); + if let PatKind::Wild = local.pat.kind; + then { + // report your lint here + } +} +if_chain! { + if let ExprKind::If(cond, then, Some(else_expr)) = expr.kind; + if let ExprKind::Let(let_expr) = cond.kind; + if let PatKind::Lit(lit_expr) = let_expr.pat.kind; + if let ExprKind::Lit(ref lit) = lit_expr.kind; + if let LitKind::Bool(true) = lit.node; + if let ExprKind::Path(ref qpath) = let_expr.init.kind; + if match_qpath(qpath, &["a"]); + if let ExprKind::Block(block, None) = then.kind; + if block.stmts.is_empty(); + if block.expr.is_none(); + if let ExprKind::Block(block1, None) = else_expr.kind; + if block1.stmts.is_empty(); + if block1.expr.is_none(); + then { + // report your lint here + } +} -- cgit v1.2.3