@@ -11,11 +11,8 @@ if_chain! {
11
11
// unimplemented: field checks
12
12
if arms.len() == 1;
13
13
if let ExprKind::Loop(ref body, ref label, LoopSource::ForLoop) = arms[0].body.kind;
14
- if body.stmts.len() == 4;
15
- if let StmtKind::Local(ref local) = body.stmts[0].kind;
16
- if let PatKind::Binding(BindingAnnotation::Mutable, _, name, None) = local.pat.kind;
17
- if name.as_str() == "__next";
18
- if let StmtKind::Expr(ref e, _) = body.stmts[1].kind
14
+ if body.stmts.len() == 1;
15
+ if let StmtKind::Expr(ref e, _) = body.stmts[0].kind
19
16
if let ExprKind::Match(ref expr2, ref arms1, MatchSource::ForLoopDesugar) = e.kind;
20
17
if let ExprKind::Call(ref func1, ref args1) = expr2.kind;
21
18
if let ExprKind::Path(ref path2) = func1.kind;
@@ -25,39 +22,27 @@ if_chain! {
25
22
if let ExprKind::Path(ref path3) = inner.kind;
26
23
if match_qpath(path3, &["iter"]);
27
24
if arms1.len() == 2;
28
- if let ExprKind::Assign(ref target, ref value, ref _span) = arms1[0].body.kind;
29
- if let ExprKind::Path(ref path4) = target.kind;
30
- if match_qpath(path4, &["__next"]);
31
- if let ExprKind::Path(ref path5) = value.kind;
32
- if match_qpath(path5, &["val"]);
33
- if let PatKind::Struct(ref path6, ref fields1, false) = arms1[0].pat.kind;
34
- if matches!(path6, QPath::LangItem(LangItem::OptionSome, _));
35
- if fields1.len() == 1;
36
- // unimplemented: field checks
37
- if let ExprKind::Break(ref destination, None) = arms1[1].body.kind;
38
- if let PatKind::Struct(ref path7, ref fields2, false) = arms1[1].pat.kind;
39
- if matches!(path7, QPath::LangItem(LangItem::OptionNone, _));
40
- if fields2.len() == 0;
25
+ if let ExprKind::Break(ref destination, None) = arms1[0].body.kind;
26
+ if let PatKind::Struct(ref path4, ref fields1, false) = arms1[0].pat.kind;
27
+ if matches!(path4, QPath::LangItem(LangItem::OptionNone, _));
28
+ if fields1.len() == 0;
41
29
// unimplemented: field checks
42
- if let StmtKind::Local(ref local1) = body.stmts[2].kind;
43
- if let Some(ref init) = local1.init;
44
- if let ExprKind::Path(ref path8) = init.kind;
45
- if match_qpath(path8, &["__next"]);
46
- if let PatKind::Binding(BindingAnnotation::Unannotated, _, name1, None) = local1.pat.kind;
47
- if name1.as_str() == "y";
48
- if let StmtKind::Expr(ref e1, _) = body.stmts[3].kind
49
- if let ExprKind::Block(ref block) = e1.kind;
30
+ if let ExprKind::Block(ref block) = arms1[1].body.kind;
50
31
if block.stmts.len() == 1;
51
- if let StmtKind::Local(ref local2 ) = block.stmts[0].kind;
52
- if let Some(ref init1 ) = local2 .init;
53
- if let ExprKind::Path(ref path9 ) = init1 .kind;
54
- if match_qpath(path9 , &["y"]);
55
- if let PatKind::Binding(BindingAnnotation::Unannotated, _, name2 , None) = local2 .pat.kind;
56
- if name2 .as_str() == "z";
32
+ if let StmtKind::Local(ref local ) = block.stmts[0].kind;
33
+ if let Some(ref init ) = local .init;
34
+ if let ExprKind::Path(ref path5 ) = init .kind;
35
+ if match_qpath(path5 , &["y"]);
36
+ if let PatKind::Binding(BindingAnnotation::Unannotated, _, name , None) = local .pat.kind;
37
+ if name .as_str() == "z";
57
38
if block.expr.is_none();
39
+ if let PatKind::Struct(ref path6, ref fields2, false) = arms1[1].pat.kind;
40
+ if matches!(path6, QPath::LangItem(LangItem::OptionSome, _));
41
+ if fields2.len() == 1;
42
+ // unimplemented: field checks
58
43
if body.expr.is_none();
59
- if let PatKind::Binding(BindingAnnotation::Mutable, _, name3 , None) = arms[0].pat.kind;
60
- if name3 .as_str() == "iter";
44
+ if let PatKind::Binding(BindingAnnotation::Mutable, _, name1 , None) = arms[0].pat.kind;
45
+ if name1 .as_str() == "iter";
61
46
then {
62
47
// report your lint here
63
48
}
0 commit comments