]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/author/blocks.stdout
author: Remove needless `ref`s
[rust.git] / tests / ui / author / blocks.stdout
index c8ef75e48fc220ecf79eecbbcd62323cc39a8a70..b1b387367257bf13b5e0c4ae5ac88be99979410c 100644 (file)
@@ -1,12 +1,63 @@
 if_chain! {
-    if let ExprKind::Block(ref block) = expr.kind;
-    if let Some(trailing_expr) = &block.expr;
-    if block.stmts.len() == 0;
+    if let ExprKind::Block(block, label) = expr.kind;
+    if block.stmts.len() == 3;
+    if let StmtKind::Local(local) = block.stmts[0].kind;
+    if let Some(init) = local.init;
+    if let ExprKind::Lit(ref lit) = init.kind;
+    if let LitKind::Int(42, LitIntType::Signed(IntTy::I32)) = lit.node;
+    if let PatKind::Binding(BindingAnnotation::Unannotated, _, name, None) = local.pat.kind;
+    if name.as_str() == "x";
+    if let StmtKind::Local(local1) = block.stmts[1].kind;
+    if let Some(init1) = local1.init;
+    if let ExprKind::Lit(ref lit1) = init1.kind;
+    if let LitKind::Float(_, LitFloatType::Suffixed(FloatTy::F32)) = lit1.node;
+    if let PatKind::Binding(BindingAnnotation::Unannotated, _, name1, None) = local1.pat.kind;
+    if name1.as_str() == "_t";
+    if let StmtKind::Semi(e) = block.stmts[2].kind;
+    if let ExprKind::Unary(UnOp::Neg, inner) = e.kind;
+    if let ExprKind::Path(ref qpath) = inner.kind;
+    if match_qpath(qpath, &["x"]);
+    if block.expr.is_none();
     then {
         // report your lint here
     }
 }
 if_chain! {
+    if let ExprKind::Block(block, label) = expr.kind;
+    if block.stmts.len() == 1;
+    if let StmtKind::Local(local) = block.stmts[0].kind;
+    if let Some(init) = local.init;
+    if let ExprKind::Call(func, args) = init.kind;
+    if let ExprKind::Path(ref qpath) = func.kind;
+    if match_qpath(qpath, &["String", "new"]);
+    if args.len() == 0;
+    if let PatKind::Binding(BindingAnnotation::Unannotated, _, name, None) = local.pat.kind;
+    if name.as_str() == "expr";
+    if let Some(trailing_expr) = block.expr;
+    if let ExprKind::Call(func1, args1) = trailing_expr.kind;
+    if let ExprKind::Path(ref qpath1) = func1.kind;
+    if match_qpath(qpath1, &["drop"]);
+    if args1.len() == 1;
+    if let ExprKind::Path(ref qpath2) = args1[0].kind;
+    if match_qpath(qpath2, &["expr"]);
+    then {
+        // report your lint here
+    }
+}
+if_chain! {
+    if let ExprKind::Closure(CaptureBy::Value, fn_decl, body_id, _, None) = expr.kind;
+    if let FnRetTy::DefaultReturn(_) = fn_decl.output;
+    let body = cx.tcx.hir().body(body_id);
+    if let ExprKind::Call(func, args) = body.value.kind;
+    if let ExprKind::Path(ref qpath) = func.kind;
+    if matches!(qpath, QPath::LangItem(LangItem::FromGenerator, _));
+    if args.len() == 1;
+    if let ExprKind::Closure(CaptureBy::Value, fn_decl1, body_id1, _, Some(Movability::Static)) = args[0].kind;
+    if let FnRetTy::DefaultReturn(_) = fn_decl1.output;
+    let body1 = cx.tcx.hir().body(body_id1);
+    if let ExprKind::Block(block, label) = body1.value.kind;
+    if block.stmts.len() == 0;
+    if block.expr.is_none();
     then {
         // report your lint here
     }