]> git.lizzy.rs Git - rust.git/blob - tests/ui/needless_continue.stderr
iterate List by value
[rust.git] / tests / ui / needless_continue.stderr
1 error: this `else` block is redundant
2   --> $DIR/needless_continue.rs:28:16
3    |
4 LL |           } else {
5    |  ________________^
6 LL | |             continue;
7 LL | |         }
8    | |_________^
9    |
10    = note: `-D clippy::needless-continue` implied by `-D warnings`
11    = help: consider dropping the `else` clause and merging the code that follows (in the loop) with the `if` block
12                    if i % 2 == 0 && i % 3 == 0 {
13                        println!("{}", i);
14                        println!("{}", i + 1);
15                        if i % 5 == 0 {
16                            println!("{}", i + 2);
17                        }
18                        let i = 0;
19                        println!("bar {} ", i);
20                        // merged code follows:
21                        println!("bleh");
22                        {
23                            println!("blah");
24                        }
25                        if !(!(i == 2) || !(i == 5)) {
26                            println!("lama");
27                        }
28                        if (zero!(i % 2) || nonzero!(i % 5)) && i % 3 != 0 {
29                            continue;
30                        } else {
31                            println!("Blabber");
32                            println!("Jabber");
33                        }
34                        println!("bleh");
35                    }
36
37 error: there is no need for an explicit `else` block for this `if` expression
38   --> $DIR/needless_continue.rs:43:9
39    |
40 LL | /         if (zero!(i % 2) || nonzero!(i % 5)) && i % 3 != 0 {
41 LL | |             continue;
42 LL | |         } else {
43 LL | |             println!("Blabber");
44 LL | |             println!("Jabber");
45 LL | |         }
46    | |_________^
47    |
48    = help: consider dropping the `else` clause
49                    if (zero!(i % 2) || nonzero!(i % 5)) && i % 3 != 0 {
50                        continue;
51                    }
52                    {
53                        println!("Blabber");
54                        println!("Jabber");
55                    }
56
57 error: this `else` block is redundant
58   --> $DIR/needless_continue.rs:100:24
59    |
60 LL |                   } else {
61    |  ________________________^
62 LL | |                     continue 'inner; // should lint here
63 LL | |                 }
64    | |_________________^
65    |
66    = help: consider dropping the `else` clause and merging the code that follows (in the loop) with the `if` block
67                            if condition() {
68                                println!("bar-3");
69                                // merged code follows:
70                                println!("bar-4");
71                                update_condition();
72                                if condition() {
73                                    continue; // should lint here
74                                } else {
75                                    println!("bar-5");
76                                }
77                                println!("bar-6");
78                            }
79
80 error: there is no need for an explicit `else` block for this `if` expression
81   --> $DIR/needless_continue.rs:106:17
82    |
83 LL | /                 if condition() {
84 LL | |                     continue; // should lint here
85 LL | |                 } else {
86 LL | |                     println!("bar-5");
87 LL | |                 }
88    | |_________________^
89    |
90    = help: consider dropping the `else` clause
91                            if condition() {
92                                continue; // should lint here
93                            }
94                            {
95                                println!("bar-5");
96                            }
97
98 error: aborting due to 4 previous errors
99