mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
39 lines
1.7 KiB
Plaintext
39 lines
1.7 KiB
Plaintext
if_chain! {
|
|
if let StmtKind::Decl(ref decl, _) = stmt.node
|
|
if let DeclKind::Local(ref local) = decl.node;
|
|
if let Some(ref init) = local.init
|
|
if let ExprKind::Match(ref expr, ref arms, MatchSource::Normal) = init.node;
|
|
if let ExprKind::Lit(ref lit) = expr.node;
|
|
if let LitKind::Int(42, _) = lit.node;
|
|
if arms.len() == 3;
|
|
if let ExprKind::Lit(ref lit1) = arms[0].body.node;
|
|
if let LitKind::Int(5, _) = lit1.node;
|
|
if arms[0].pats.len() == 1;
|
|
if let PatKind::Lit(ref lit_expr) = arms[0].pats[0].node
|
|
if let ExprKind::Lit(ref lit2) = lit_expr.node;
|
|
if let LitKind::Int(16, _) = lit2.node;
|
|
if let ExprKind::Block(ref block) = arms[1].body.node;
|
|
if let StmtKind::Decl(ref decl1, _) = block.node
|
|
if let DeclKind::Local(ref local1) = decl1.node;
|
|
if let Some(ref init1) = local1.init
|
|
if let ExprKind::Lit(ref lit3) = init1.node;
|
|
if let LitKind::Int(3, _) = lit3.node;
|
|
if let PatKind::Binding(BindingAnnotation::Unannotated, _, name, None) = local1.pat.node;
|
|
if name.node.as_str() == "x";
|
|
if let ExprKind::Path(ref path) = local1.pat.node;
|
|
if match_qpath(path, &["x"]);
|
|
if arms[1].pats.len() == 1;
|
|
if let PatKind::Lit(ref lit_expr1) = arms[1].pats[0].node
|
|
if let ExprKind::Lit(ref lit4) = lit_expr1.node;
|
|
if let LitKind::Int(17, _) = lit4.node;
|
|
if let ExprKind::Lit(ref lit5) = arms[2].body.node;
|
|
if let LitKind::Int(1, _) = lit5.node;
|
|
if arms[2].pats.len() == 1;
|
|
if let PatKind::Wild = arms[2].pats[0].node;
|
|
if let PatKind::Binding(BindingAnnotation::Unannotated, _, name1, None) = local.pat.node;
|
|
if name1.node.as_str() == "a";
|
|
then {
|
|
// report your lint here
|
|
}
|
|
}
|