mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 15:11:30 +00:00
28 lines
1.1 KiB
Text
28 lines
1.1 KiB
Text
|
if_chain! {
|
||
|
if let StmtKind::Local(ref local) = stmt.node;
|
||
|
if let Some(ref init) = local.init;
|
||
|
if let Some((ref cond, ref then, Some(else_))) = higher::if_block(&init);
|
||
|
if let ExprKind::Block(ref block) = else_.node;
|
||
|
if let StmtKind::Semi(ref e, _) = block.node
|
||
|
if let ExprKind::Binary(ref op, ref left, ref right) = e.node;
|
||
|
if BinOpKind::Eq == op.node;
|
||
|
if let ExprKind::Lit(ref lit) = left.node;
|
||
|
if let LitKind::Int(2, _) = lit.node;
|
||
|
if let ExprKind::Lit(ref lit1) = right.node;
|
||
|
if let LitKind::Int(2, _) = lit1.node;
|
||
|
if let ExprKind::Lit(ref lit2) = cond.node;
|
||
|
if let LitKind::Bool(true) = lit2.node;
|
||
|
if let ExprKind::Block(ref block1) = then.node;
|
||
|
if let StmtKind::Semi(ref e1, _) = block1.node
|
||
|
if let ExprKind::Binary(ref op1, ref left1, ref right1) = e1.node;
|
||
|
if BinOpKind::Eq == op1.node;
|
||
|
if let ExprKind::Lit(ref lit3) = left1.node;
|
||
|
if let LitKind::Int(1, _) = lit3.node;
|
||
|
if let ExprKind::Lit(ref lit4) = right1.node;
|
||
|
if let LitKind::Int(1, _) = lit4.node;
|
||
|
if let PatKind::Wild = local.pat.node;
|
||
|
then {
|
||
|
// report your lint here
|
||
|
}
|
||
|
}
|