2019-05-11 06:36:49 +00:00
|
|
|
if_chain! {
|
2019-09-27 15:16:06 +00:00
|
|
|
if let StmtKind::Local(ref local) = stmt.kind;
|
2019-05-11 06:36:49 +00:00
|
|
|
if let Some(ref init) = local.init;
|
2021-01-01 18:38:11 +00:00
|
|
|
if let ExprKind::If(ref cond, ref then, Some(ref else_)) = init.kind;
|
2019-09-27 15:16:06 +00:00
|
|
|
if let ExprKind::Block(ref block) = else_.kind;
|
2019-05-19 14:52:44 +00:00
|
|
|
if block.stmts.len() == 1;
|
2019-09-27 15:16:06 +00:00
|
|
|
if let StmtKind::Semi(ref e, _) = block.stmts[0].kind
|
|
|
|
if let ExprKind::Binary(ref op, ref left, ref right) = e.kind;
|
2019-05-11 06:36:49 +00:00
|
|
|
if BinOpKind::Eq == op.node;
|
2019-09-27 15:16:06 +00:00
|
|
|
if let ExprKind::Lit(ref lit) = left.kind;
|
2019-05-11 06:36:49 +00:00
|
|
|
if let LitKind::Int(2, _) = lit.node;
|
2019-09-27 15:16:06 +00:00
|
|
|
if let ExprKind::Lit(ref lit1) = right.kind;
|
2019-05-11 06:36:49 +00:00
|
|
|
if let LitKind::Int(2, _) = lit1.node;
|
2021-07-29 10:16:06 +00:00
|
|
|
if block.expr.is_none();
|
2021-08-08 14:49:13 +00:00
|
|
|
if let ExprKind::DropTemps(ref expr) = cond.kind;
|
|
|
|
if let ExprKind::Lit(ref lit2) = expr.kind;
|
2019-05-11 06:36:49 +00:00
|
|
|
if let LitKind::Bool(true) = lit2.node;
|
2019-09-27 15:16:06 +00:00
|
|
|
if let ExprKind::Block(ref block1) = then.kind;
|
2019-05-19 14:52:44 +00:00
|
|
|
if block1.stmts.len() == 1;
|
2019-09-27 15:16:06 +00:00
|
|
|
if let StmtKind::Semi(ref e1, _) = block1.stmts[0].kind
|
|
|
|
if let ExprKind::Binary(ref op1, ref left1, ref right1) = e1.kind;
|
2019-05-11 06:36:49 +00:00
|
|
|
if BinOpKind::Eq == op1.node;
|
2019-09-27 15:16:06 +00:00
|
|
|
if let ExprKind::Lit(ref lit3) = left1.kind;
|
2019-05-11 06:36:49 +00:00
|
|
|
if let LitKind::Int(1, _) = lit3.node;
|
2019-09-27 15:16:06 +00:00
|
|
|
if let ExprKind::Lit(ref lit4) = right1.kind;
|
2019-05-11 06:36:49 +00:00
|
|
|
if let LitKind::Int(1, _) = lit4.node;
|
2021-07-29 10:16:06 +00:00
|
|
|
if block1.expr.is_none();
|
2019-09-27 15:16:06 +00:00
|
|
|
if let PatKind::Wild = local.pat.kind;
|
2019-05-11 06:36:49 +00:00
|
|
|
then {
|
|
|
|
// report your lint here
|
|
|
|
}
|
|
|
|
}
|