]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/author/if.stdout
5d79618820d80595dd9db6a50bfebb3c42d7df90
[rust.git] / src / tools / clippy / tests / ui / author / if.stdout
1 if let StmtKind::Local(local) = stmt.kind
2     && let Some(init) = local.init
3     && let ExprKind::If(cond, then, Some(else_expr)) = init.kind
4     && let ExprKind::DropTemps(expr) = cond.kind
5     && let ExprKind::Lit(ref lit) = expr.kind
6     && let LitKind::Bool(true) = lit.node
7     && let ExprKind::Block(block, None) = then.kind
8     && block.stmts.len() == 1
9     && let StmtKind::Semi(e) = block.stmts[0].kind
10     && let ExprKind::Binary(op, left, right) = e.kind
11     && BinOpKind::Eq == op.node
12     && let ExprKind::Lit(ref lit1) = left.kind
13     && let LitKind::Int(1, LitIntType::Unsuffixed) = lit1.node
14     && let ExprKind::Lit(ref lit2) = right.kind
15     && let LitKind::Int(1, LitIntType::Unsuffixed) = lit2.node
16     && block.expr.is_none()
17     && let ExprKind::Block(block1, None) = else_expr.kind
18     && block1.stmts.len() == 1
19     && let StmtKind::Semi(e1) = block1.stmts[0].kind
20     && let ExprKind::Binary(op1, left1, right1) = e1.kind
21     && BinOpKind::Eq == op1.node
22     && let ExprKind::Lit(ref lit3) = left1.kind
23     && let LitKind::Int(2, LitIntType::Unsuffixed) = lit3.node
24     && let ExprKind::Lit(ref lit4) = right1.kind
25     && let LitKind::Int(2, LitIntType::Unsuffixed) = lit4.node
26     && block1.expr.is_none()
27     && let PatKind::Wild = local.pat.kind
28 {
29     // report your lint here
30 }
31 if let ExprKind::If(cond, then, Some(else_expr)) = expr.kind
32     && let ExprKind::Let(let_expr) = cond.kind
33     && let PatKind::Lit(lit_expr) = let_expr.pat.kind
34     && let ExprKind::Lit(ref lit) = lit_expr.kind
35     && let LitKind::Bool(true) = lit.node
36     && let ExprKind::Path(ref qpath) = let_expr.init.kind
37     && match_qpath(qpath, &["a"])
38     && let ExprKind::Block(block, None) = then.kind
39     && block.stmts.is_empty()
40     && block.expr.is_none()
41     && let ExprKind::Block(block1, None) = else_expr.kind
42     && block1.stmts.is_empty()
43     && block1.expr.is_none()
44 {
45     // report your lint here
46 }