2024-06-13 05:30:48 -05:00
|
|
|
if let StmtKind::Let(local) = stmt.kind
|
2022-10-23 08:18:45 -05:00
|
|
|
&& let Some(init) = local.init
|
|
|
|
&& let ExprKind::Match(scrutinee, arms, MatchSource::Normal) = init.kind
|
|
|
|
&& let ExprKind::Lit(ref lit) = scrutinee.kind
|
|
|
|
&& let LitKind::Int(42, LitIntType::Unsuffixed) = lit.node
|
|
|
|
&& arms.len() == 3
|
|
|
|
&& let PatKind::Lit(lit_expr) = arms[0].pat.kind
|
|
|
|
&& let ExprKind::Lit(ref lit1) = lit_expr.kind
|
|
|
|
&& let LitKind::Int(16, LitIntType::Unsuffixed) = lit1.node
|
|
|
|
&& arms[0].guard.is_none()
|
|
|
|
&& let ExprKind::Lit(ref lit2) = arms[0].body.kind
|
|
|
|
&& let LitKind::Int(5, LitIntType::Unsuffixed) = lit2.node
|
|
|
|
&& let PatKind::Lit(lit_expr1) = arms[1].pat.kind
|
|
|
|
&& let ExprKind::Lit(ref lit3) = lit_expr1.kind
|
|
|
|
&& let LitKind::Int(17, LitIntType::Unsuffixed) = lit3.node
|
|
|
|
&& arms[1].guard.is_none()
|
|
|
|
&& let ExprKind::Block(block, None) = arms[1].body.kind
|
|
|
|
&& block.stmts.len() == 1
|
2024-06-13 05:30:48 -05:00
|
|
|
&& let StmtKind::Let(local1) = block.stmts[0].kind
|
2022-10-23 08:18:45 -05:00
|
|
|
&& let Some(init1) = local1.init
|
|
|
|
&& let ExprKind::Lit(ref lit4) = init1.kind
|
|
|
|
&& let LitKind::Int(3, LitIntType::Unsuffixed) = lit4.node
|
2024-04-16 18:23:30 -05:00
|
|
|
&& let PatKind::Binding(BindingMode::NONE, _, name, None) = local1.pat.kind
|
2022-10-23 08:18:45 -05:00
|
|
|
&& name.as_str() == "x"
|
|
|
|
&& let Some(trailing_expr) = block.expr
|
|
|
|
&& let ExprKind::Path(ref qpath) = trailing_expr.kind
|
|
|
|
&& match_qpath(qpath, &["x"])
|
|
|
|
&& let PatKind::Wild = arms[2].pat.kind
|
|
|
|
&& arms[2].guard.is_none()
|
|
|
|
&& let ExprKind::Lit(ref lit5) = arms[2].body.kind
|
|
|
|
&& let LitKind::Int(1, LitIntType::Unsuffixed) = lit5.node
|
2024-04-16 18:23:30 -05:00
|
|
|
&& let PatKind::Binding(BindingMode::NONE, _, name1, None) = local.pat.kind
|
2022-10-23 08:18:45 -05:00
|
|
|
&& name1.as_str() == "a"
|
|
|
|
{
|
|
|
|
// report your lint here
|
2019-09-27 11:01:04 -05:00
|
|
|
}
|