fork/rust

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

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

master
2.3 KiB54 linesraw
1if let ExprKind::Block(block, None) = expr.kind
2    && block.stmts.len() == 3
3    && let StmtKind::Local(local) = block.stmts[0].kind
4    && let Some(init) = local.init
5    && let ExprKind::Lit(ref lit) = init.kind
6    && let LitKind::Int(42, LitIntType::Signed(IntTy::I32)) = lit.node
7    && let PatKind::Binding(BindingAnnotation::NONE, _, name, None) = local.pat.kind
8    && name.as_str() == "x"
9    && let StmtKind::Local(local1) = block.stmts[1].kind
10    && let Some(init1) = local1.init
11    && let ExprKind::Lit(ref lit1) = init1.kind
12    && let LitKind::Float(_, LitFloatType::Suffixed(FloatTy::F32)) = lit1.node
13    && let PatKind::Binding(BindingAnnotation::NONE, _, name1, None) = local1.pat.kind
14    && name1.as_str() == "_t"
15    && let StmtKind::Semi(e) = block.stmts[2].kind
16    && let ExprKind::Unary(UnOp::Neg, inner) = e.kind
17    && let ExprKind::Path(ref qpath) = inner.kind
18    && match_qpath(qpath, &["x"])
19    && block.expr.is_none()
20{
21    // report your lint here
22}
23if let ExprKind::Block(block, None) = expr.kind
24    && block.stmts.len() == 1
25    && let StmtKind::Local(local) = block.stmts[0].kind
26    && let Some(init) = local.init
27    && let ExprKind::Call(func, args) = init.kind
28    && let ExprKind::Path(ref qpath) = func.kind
29    && match_qpath(qpath, &["String", "new"])
30    && args.is_empty()
31    && let PatKind::Binding(BindingAnnotation::NONE, _, name, None) = local.pat.kind
32    && name.as_str() == "expr"
33    && let Some(trailing_expr) = block.expr
34    && let ExprKind::Call(func1, args1) = trailing_expr.kind
35    && let ExprKind::Path(ref qpath1) = func1.kind
36    && match_qpath(qpath1, &["drop"])
37    && args1.len() == 1
38    && let ExprKind::Path(ref qpath2) = args1[0].kind
39    && match_qpath(qpath2, &["expr"])
40{
41    // report your lint here
42}
43if let ExprKind::Closure(CaptureBy::Value, fn_decl, body_id, _, None) = expr.kind
44    && let FnRetTy::DefaultReturn(_) = fn_decl.output
45    && expr1 = &cx.tcx.hir().body(body_id).value
46    && let ExprKind::Closure(CaptureBy::Value, fn_decl1, body_id1, _, Some(Movability::Static)) = expr1.kind
47    && let FnRetTy::DefaultReturn(_) = fn_decl1.output
48    && expr2 = &cx.tcx.hir().body(body_id1).value
49    && let ExprKind::Block(block, None) = expr2.kind
50    && block.stmts.is_empty()
51    && block.expr.is_none()
52{
53    // report your lint here
54}