1
1
if_chain! {
2
- if let ExprKind::Block(ref block) = expr.node;
3
- if let StmtKind::Local(ref local) = block.node;
4
- if let Some(ref init) = local.init;
5
- if let ExprKind::Match(ref expr, ref arms, MatchSource::ForLoopDesugar) = init.node;
2
+ if let ExprKind::Use(ref inner) = expr.node;
3
+ if let ExprKind::Match(ref expr, ref arms, MatchSource::ForLoopDesugar) = inner.node;
6
4
if let ExprKind::Call(ref func, ref args) = expr.node;
7
5
if let ExprKind::Path(ref path) = func.node;
8
6
if match_qpath(path, &["{{root}}", "std", "iter", "IntoIterator", "into_iter"]);
@@ -13,17 +11,17 @@ if_chain! {
13
11
// unimplemented: field checks
14
12
if arms.len() == 1;
15
13
if let ExprKind::Loop(ref body, ref label, LoopSource::ForLoop) = arms[0].body.node;
16
- if let StmtKind::Local(ref local1 ) = body.node;
17
- if let PatKind::Binding(BindingAnnotation::Mutable, _, name, None) = local1 .pat.node;
14
+ if let StmtKind::Local(ref local ) = body.node;
15
+ if let PatKind::Binding(BindingAnnotation::Mutable, _, name, None) = local .pat.node;
18
16
if name.node.as_str() == "__next";
19
- if let StmtKind::Expr(ref e, _) = local1 .pat.node
17
+ if let StmtKind::Expr(ref e, _) = local .pat.node
20
18
if let ExprKind::Match(ref expr1, ref arms1, MatchSource::ForLoopDesugar) = e.node;
21
19
if let ExprKind::Call(ref func1, ref args1) = expr1.node;
22
20
if let ExprKind::Path(ref path2) = func1.node;
23
21
if match_qpath(path2, &["{{root}}", "std", "iter", "Iterator", "next"]);
24
22
if args1.len() == 1;
25
- if let ExprKind::AddrOf(MutMutable, ref inner ) = args1[0].node;
26
- if let ExprKind::Path(ref path3) = inner .node;
23
+ if let ExprKind::AddrOf(MutMutable, ref inner1 ) = args1[0].node;
24
+ if let ExprKind::Path(ref path3) = inner1 .node;
27
25
if match_qpath(path3, &["iter"]);
28
26
if arms1.len() == 2;
29
27
if let ExprKind::Assign(ref target, ref value) = arms1[0].body.node;
@@ -40,27 +38,23 @@ if_chain! {
40
38
if arms1[1].pats.len() == 1;
41
39
if let PatKind::Path(ref path7) = arms1[1].pats[0].node;
42
40
if match_qpath(path7, &["{{root}}", "std", "option", "Option", "None"]);
43
- if let StmtKind::Local(ref local2 ) = path7.node;
44
- if let Some(ref init1 ) = local2 .init;
45
- if let ExprKind::Path(ref path8) = init1 .node;
41
+ if let StmtKind::Local(ref local1 ) = path7.node;
42
+ if let Some(ref init ) = local1 .init;
43
+ if let ExprKind::Path(ref path8) = init .node;
46
44
if match_qpath(path8, &["__next"]);
47
- if let PatKind::Binding(BindingAnnotation::Unannotated, _, name1, None) = local2 .pat.node;
45
+ if let PatKind::Binding(BindingAnnotation::Unannotated, _, name1, None) = local1 .pat.node;
48
46
if name1.node.as_str() == "y";
49
- if let StmtKind::Expr(ref e1, _) = local2 .pat.node
50
- if let ExprKind::Block(ref block1 ) = e1.node;
51
- if let StmtKind::Local(ref local3 ) = block1 .node;
52
- if let Some(ref init2 ) = local3 .init;
53
- if let ExprKind::Path(ref path9) = init2 .node;
47
+ if let StmtKind::Expr(ref e1, _) = local1 .pat.node
48
+ if let ExprKind::Block(ref block ) = e1.node;
49
+ if let StmtKind::Local(ref local2 ) = block .node;
50
+ if let Some(ref init1 ) = local2 .init;
51
+ if let ExprKind::Path(ref path9) = init1 .node;
54
52
if match_qpath(path9, &["y"]);
55
- if let PatKind::Binding(BindingAnnotation::Unannotated, _, name2, None) = local3 .pat.node;
53
+ if let PatKind::Binding(BindingAnnotation::Unannotated, _, name2, None) = local2 .pat.node;
56
54
if name2.node.as_str() == "z";
57
55
if arms[0].pats.len() == 1;
58
56
if let PatKind::Binding(BindingAnnotation::Mutable, _, name3, None) = arms[0].pats[0].node;
59
57
if name3.node.as_str() == "iter";
60
- if let PatKind::Binding(BindingAnnotation::Unannotated, _, name4, None) = local.pat.node;
61
- if name4.node.as_str() == "_result";
62
- if let ExprKind::Path(ref path10) = local.pat.node;
63
- if match_qpath(path10, &["_result"]);
64
58
then {
65
59
// report your lint here
66
60
}
0 commit comments