rust/tests/ui/author/for_loop.stdout
2019-11-27 14:39:28 -08:00

63 lines
3.1 KiB
Plaintext

if_chain! {
if let ExprKind::DropTemps(ref expr) = expr.kind;
if let ExprKind::Match(ref expr1, ref arms, MatchSource::ForLoopDesugar) = expr.kind;
if let ExprKind::Call(ref func, ref args) = expr1.kind;
if let ExprKind::Path(ref path) = func.kind;
if match_qpath(path, &["{{root}}", "std", "iter", "IntoIterator", "into_iter"]);
if args.len() == 1;
if let ExprKind::Struct(ref path1, ref fields, None) = args[0].kind;
if match_qpath(path1, &["{{root}}", "std", "ops", "Range"]);
if fields.len() == 2;
// unimplemented: field checks
if arms.len() == 1;
if let ExprKind::Loop(ref body, ref label, LoopSource::ForLoop) = arms[0].body.kind;
if let Some(trailing_expr) = &body.expr;
if body.stmts.len() == 4;
if let StmtKind::Local(ref local) = body.stmts[0].kind;
if let PatKind::Binding(BindingAnnotation::Mutable, _, name, None) = local.pat.kind;
if name.as_str() == "__next";
if let StmtKind::Expr(ref e, _) = body.stmts[1].kind
if let ExprKind::Match(ref expr2, ref arms1, MatchSource::ForLoopDesugar) = e.kind;
if let ExprKind::Call(ref func1, ref args1) = expr2.kind;
if let ExprKind::Path(ref path2) = func1.kind;
if match_qpath(path2, &["{{root}}", "std", "iter", "Iterator", "next"]);
if args1.len() == 1;
if let ExprKind::AddrOf(BorrowKind::Ref, Mutability::Mutable, ref inner) = args1[0].kind;
if let ExprKind::Path(ref path3) = inner.kind;
if match_qpath(path3, &["iter"]);
if arms1.len() == 2;
if let ExprKind::Assign(ref target, ref value) = arms1[0].body.kind;
if let ExprKind::Path(ref path4) = target.kind;
if match_qpath(path4, &["__next"]);
if let ExprKind::Path(ref path5) = value.kind;
if match_qpath(path5, &["val"]);
if let PatKind::TupleStruct(ref path6, ref fields1, None) = arms1[0].pat.kind;
if match_qpath(path6, &["{{root}}", "std", "option", "Option", "Some"]);
if fields1.len() == 1;
// unimplemented: field checks
if let ExprKind::Break(ref destination, None) = arms1[1].body.kind;
if let PatKind::Path(ref path7) = arms1[1].pat.kind;
if match_qpath(path7, &["{{root}}", "std", "option", "Option", "None"]);
if let StmtKind::Local(ref local1) = body.stmts[2].kind;
if let Some(ref init) = local1.init;
if let ExprKind::Path(ref path8) = init.kind;
if match_qpath(path8, &["__next"]);
if let PatKind::Binding(BindingAnnotation::Unannotated, _, name1, None) = local1.pat.kind;
if name1.as_str() == "y";
if let StmtKind::Expr(ref e1, _) = body.stmts[3].kind
if let ExprKind::Block(ref block) = e1.kind;
if let Some(trailing_expr1) = &block.expr;
if block.stmts.len() == 1;
if let StmtKind::Local(ref local2) = block.stmts[0].kind;
if let Some(ref init1) = local2.init;
if let ExprKind::Path(ref path9) = init1.kind;
if match_qpath(path9, &["y"]);
if let PatKind::Binding(BindingAnnotation::Unannotated, _, name2, None) = local2.pat.kind;
if name2.as_str() == "z";
if let PatKind::Binding(BindingAnnotation::Mutable, _, name3, None) = arms[0].pat.kind;
if name3.as_str() == "iter";
then {
// report your lint here
}
}