]> git.lizzy.rs Git - rust.git/blob - tests/ui/author/blocks.stdout
author: fix some bugs
[rust.git] / tests / ui / author / blocks.stdout
1 if_chain! {
2     if let ExprKind::Block(ref block, ref label) = expr.kind;
3     if block.stmts.len() == 3;
4     if let StmtKind::Local(ref local) = block.stmts[0].kind;
5     if let Some(ref init) = local.init;
6     if let ExprKind::Lit(ref lit) = init.kind;
7     if let LitKind::Int(42, LitIntType::Signed(IntTy::I32)) = lit.node;
8     if let PatKind::Binding(BindingAnnotation::Unannotated, _, name, None) = local.pat.kind;
9     if name.as_str() == "x";
10     if let StmtKind::Local(ref local1) = block.stmts[1].kind;
11     if let Some(ref init1) = local1.init;
12     if let ExprKind::Lit(ref lit1) = init1.kind;
13     if let LitKind::Float(_, LitFloatType::Suffixed(FloatTy::F32)) = lit1.node;
14     if let PatKind::Binding(BindingAnnotation::Unannotated, _, name1, None) = local1.pat.kind;
15     if name1.as_str() == "_t";
16     if let StmtKind::Semi(ref e) = block.stmts[2].kind;
17     if let ExprKind::Unary(UnOp::Neg, ref inner) = e.kind;
18     if let ExprKind::Path(ref qpath) = inner.kind;
19     if match_qpath(qpath, &["x"]);
20     if block.expr.is_none();
21     then {
22         // report your lint here
23     }
24 }
25 if_chain! {
26     if let ExprKind::Block(ref block, ref label) = expr.kind;
27     if block.stmts.len() == 1;
28     if let StmtKind::Local(ref local) = block.stmts[0].kind;
29     if let Some(ref init) = local.init;
30     if let ExprKind::Call(ref func, ref args) = init.kind;
31     if let ExprKind::Path(ref qpath) = func.kind;
32     if match_qpath(qpath, &["String", "new"]);
33     if args.len() == 0;
34     if let PatKind::Binding(BindingAnnotation::Unannotated, _, name, None) = local.pat.kind;
35     if name.as_str() == "expr";
36     if let Some(trailing_expr) = &block.expr;
37     if let ExprKind::Call(ref func1, ref args1) = trailing_expr.kind;
38     if let ExprKind::Path(ref qpath1) = func1.kind;
39     if match_qpath(qpath1, &["drop"]);
40     if args1.len() == 1;
41     if let ExprKind::Path(ref qpath2) = args1[0].kind;
42     if match_qpath(qpath2, &["expr"]);
43     then {
44         // report your lint here
45     }
46 }
47 if_chain! {
48     if let ExprKind::Closure(CaptureBy::Value, ref fn_decl, ref body_id, _, None) = expr.kind;
49     if let FnRetTy::DefaultReturn(_) = fn_decl.output;
50     let body = cx.tcx.hir().body(body_id);
51     if let ExprKind::Call(ref func, ref args) = body.value.kind;
52     if let ExprKind::Path(ref qpath) = func.kind;
53     if matches!(qpath, QPath::LangItem(LangItem::FromGenerator, _));
54     if args.len() == 1;
55     if let ExprKind::Closure(CaptureBy::Value, ref fn_decl1, ref body_id1, _, Some(Movability::Static)) = args[0].kind;
56     if let FnRetTy::DefaultReturn(_) = fn_decl1.output;
57     let body1 = cx.tcx.hir().body(body_id1);
58     if let ExprKind::Block(ref block, ref label) = body1.value.kind;
59     if block.stmts.len() == 0;
60     if block.expr.is_none();
61     then {
62         // report your lint here
63     }
64 }