fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
1.7 KiB36 linesraw
1if let StmtKind::Local(local) = stmt.kind
2    && let Some(init) = local.init
3    && let ExprKind::Match(scrutinee, arms, MatchSource::Normal) = init.kind
4    && let ExprKind::Lit(ref lit) = scrutinee.kind
5    && let LitKind::Int(42, LitIntType::Unsuffixed) = lit.node
6    && arms.len() == 3
7    && let PatKind::Lit(lit_expr) = arms[0].pat.kind
8    && let ExprKind::Lit(ref lit1) = lit_expr.kind
9    && let LitKind::Int(16, LitIntType::Unsuffixed) = lit1.node
10    && arms[0].guard.is_none()
11    && let ExprKind::Lit(ref lit2) = arms[0].body.kind
12    && let LitKind::Int(5, LitIntType::Unsuffixed) = lit2.node
13    && let PatKind::Lit(lit_expr1) = arms[1].pat.kind
14    && let ExprKind::Lit(ref lit3) = lit_expr1.kind
15    && let LitKind::Int(17, LitIntType::Unsuffixed) = lit3.node
16    && arms[1].guard.is_none()
17    && let ExprKind::Block(block, None) = arms[1].body.kind
18    && block.stmts.len() == 1
19    && let StmtKind::Local(local1) = block.stmts[0].kind
20    && let Some(init1) = local1.init
21    && let ExprKind::Lit(ref lit4) = init1.kind
22    && let LitKind::Int(3, LitIntType::Unsuffixed) = lit4.node
23    && let PatKind::Binding(BindingAnnotation::NONE, _, name, None) = local1.pat.kind
24    && name.as_str() == "x"
25    && let Some(trailing_expr) = block.expr
26    && let ExprKind::Path(ref qpath) = trailing_expr.kind
27    && match_qpath(qpath, &["x"])
28    && let PatKind::Wild = arms[2].pat.kind
29    && arms[2].guard.is_none()
30    && let ExprKind::Lit(ref lit5) = arms[2].body.kind
31    && let LitKind::Int(1, LitIntType::Unsuffixed) = lit5.node
32    && let PatKind::Binding(BindingAnnotation::NONE, _, name1, None) = local.pat.kind
33    && name1.as_str() == "a"
34{
35    // report your lint here
36}