summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/author/loop.stdout
blob: ceb53fcd496369c11e90ea971cc02091e8c33780 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
if_chain! {
    if let Some(higher::ForLoop { pat: pat, arg: arg, body: body, .. }) = higher::ForLoop::hir(expr);
    if let PatKind::Binding(BindingAnnotation::NONE, _, name, None) = pat.kind;
    if name.as_str() == "y";
    if let ExprKind::Struct(qpath, fields, None) = arg.kind;
    if matches!(qpath, QPath::LangItem(LangItem::Range, _));
    if fields.len() == 2;
    if fields[0].ident.as_str() == "start";
    if let ExprKind::Lit(ref lit) = fields[0].expr.kind;
    if let LitKind::Int(0, LitIntType::Unsuffixed) = lit.node;
    if fields[1].ident.as_str() == "end";
    if let ExprKind::Lit(ref lit1) = fields[1].expr.kind;
    if let LitKind::Int(10, LitIntType::Unsuffixed) = lit1.node;
    if let ExprKind::Block(block, None) = body.kind;
    if block.stmts.len() == 1;
    if let StmtKind::Local(local) = block.stmts[0].kind;
    if let Some(init) = local.init;
    if let ExprKind::Path(ref qpath1) = init.kind;
    if match_qpath(qpath1, &["y"]);
    if let PatKind::Binding(BindingAnnotation::NONE, _, name1, None) = local.pat.kind;
    if name1.as_str() == "z";
    if block.expr.is_none();
    then {
        // report your lint here
    }
}
if_chain! {
    if let Some(higher::ForLoop { pat: pat, arg: arg, body: body, .. }) = higher::ForLoop::hir(expr);
    if let PatKind::Wild = pat.kind;
    if let ExprKind::Struct(qpath, fields, None) = arg.kind;
    if matches!(qpath, QPath::LangItem(LangItem::Range, _));
    if fields.len() == 2;
    if fields[0].ident.as_str() == "start";
    if let ExprKind::Lit(ref lit) = fields[0].expr.kind;
    if let LitKind::Int(0, LitIntType::Unsuffixed) = lit.node;
    if fields[1].ident.as_str() == "end";
    if let ExprKind::Lit(ref lit1) = fields[1].expr.kind;
    if let LitKind::Int(10, LitIntType::Unsuffixed) = lit1.node;
    if let ExprKind::Block(block, None) = body.kind;
    if block.stmts.len() == 1;
    if let StmtKind::Semi(e) = block.stmts[0].kind;
    if let ExprKind::Break(destination, None) = e.kind;
    if destination.label.is_none();
    if block.expr.is_none();
    then {
        // report your lint here
    }
}
if_chain! {
    if let Some(higher::ForLoop { pat: pat, arg: arg, body: body, .. }) = higher::ForLoop::hir(expr);
    if let PatKind::Wild = pat.kind;
    if let ExprKind::Struct(qpath, fields, None) = arg.kind;
    if matches!(qpath, QPath::LangItem(LangItem::Range, _));
    if fields.len() == 2;
    if fields[0].ident.as_str() == "start";
    if let ExprKind::Lit(ref lit) = fields[0].expr.kind;
    if let LitKind::Int(0, LitIntType::Unsuffixed) = lit.node;
    if fields[1].ident.as_str() == "end";
    if let ExprKind::Lit(ref lit1) = fields[1].expr.kind;
    if let LitKind::Int(10, LitIntType::Unsuffixed) = lit1.node;
    if let ExprKind::Block(block, None) = body.kind;
    if block.stmts.len() == 1;
    if let StmtKind::Semi(e) = block.stmts[0].kind;
    if let ExprKind::Break(destination, None) = e.kind;
    if let Some(label) = destination.label;
    if label.ident.as_str() == "'label";
    if block.expr.is_none();
    then {
        // report your lint here
    }
}
if_chain! {
    if let Some(higher::While { condition: condition, body: body }) = higher::While::hir(expr);
    if let ExprKind::Path(ref qpath) = condition.kind;
    if match_qpath(qpath, &["a"]);
    if let ExprKind::Block(block, None) = body.kind;
    if block.stmts.len() == 1;
    if let StmtKind::Semi(e) = block.stmts[0].kind;
    if let ExprKind::Break(destination, None) = e.kind;
    if destination.label.is_none();
    if block.expr.is_none();
    then {
        // report your lint here
    }
}
if_chain! {
    if let Some(higher::WhileLet { let_pat: let_pat, let_expr: let_expr, if_then: if_then }) = higher::WhileLet::hir(expr);
    if let PatKind::Lit(lit_expr) = let_pat.kind;
    if let ExprKind::Lit(ref lit) = lit_expr.kind;
    if let LitKind::Bool(true) = lit.node;
    if let ExprKind::Path(ref qpath) = let_expr.kind;
    if match_qpath(qpath, &["a"]);
    if let ExprKind::Block(block, None) = if_then.kind;
    if block.stmts.len() == 1;
    if let StmtKind::Semi(e) = block.stmts[0].kind;
    if let ExprKind::Break(destination, None) = e.kind;
    if destination.label.is_none();
    if block.expr.is_none();
    then {
        // report your lint here
    }
}
if_chain! {
    if let ExprKind::Loop(body, None, LoopSource::Loop, _) = expr.kind;
    if body.stmts.len() == 1;
    if let StmtKind::Semi(e) = body.stmts[0].kind;
    if let ExprKind::Break(destination, None) = e.kind;
    if destination.label.is_none();
    if body.expr.is_none();
    then {
        // report your lint here
    }
}