]>
Commit | Line | Data |
---|---|---|
f20569fa XL |
1 | error: this `if` statement can be collapsed |
2 | --> $DIR/collapsible_if.rs:9:5 | |
3 | | | |
4 | LL | / if x == "hello" { | |
5 | LL | | if y == "world" { | |
6 | LL | | println!("Hello world!"); | |
7 | LL | | } | |
8 | LL | | } | |
9 | | |_____^ | |
10 | | | |
11 | = note: `-D clippy::collapsible-if` implied by `-D warnings` | |
12 | help: collapse nested if block | |
13 | | | |
14 | LL | if x == "hello" && y == "world" { | |
15 | LL | println!("Hello world!"); | |
16 | LL | } | |
17 | | | |
18 | ||
19 | error: this `if` statement can be collapsed | |
20 | --> $DIR/collapsible_if.rs:15:5 | |
21 | | | |
22 | LL | / if x == "hello" || x == "world" { | |
23 | LL | | if y == "world" || y == "hello" { | |
24 | LL | | println!("Hello world!"); | |
25 | LL | | } | |
26 | LL | | } | |
27 | | |_____^ | |
28 | | | |
29 | help: collapse nested if block | |
30 | | | |
31 | LL | if (x == "hello" || x == "world") && (y == "world" || y == "hello") { | |
32 | LL | println!("Hello world!"); | |
33 | LL | } | |
34 | | | |
35 | ||
36 | error: this `if` statement can be collapsed | |
37 | --> $DIR/collapsible_if.rs:21:5 | |
38 | | | |
39 | LL | / if x == "hello" && x == "world" { | |
40 | LL | | if y == "world" || y == "hello" { | |
41 | LL | | println!("Hello world!"); | |
42 | LL | | } | |
43 | LL | | } | |
44 | | |_____^ | |
45 | | | |
46 | help: collapse nested if block | |
47 | | | |
48 | LL | if x == "hello" && x == "world" && (y == "world" || y == "hello") { | |
49 | LL | println!("Hello world!"); | |
50 | LL | } | |
51 | | | |
52 | ||
53 | error: this `if` statement can be collapsed | |
54 | --> $DIR/collapsible_if.rs:27:5 | |
55 | | | |
56 | LL | / if x == "hello" || x == "world" { | |
57 | LL | | if y == "world" && y == "hello" { | |
58 | LL | | println!("Hello world!"); | |
59 | LL | | } | |
60 | LL | | } | |
61 | | |_____^ | |
62 | | | |
63 | help: collapse nested if block | |
64 | | | |
65 | LL | if (x == "hello" || x == "world") && y == "world" && y == "hello" { | |
66 | LL | println!("Hello world!"); | |
67 | LL | } | |
68 | | | |
69 | ||
70 | error: this `if` statement can be collapsed | |
71 | --> $DIR/collapsible_if.rs:33:5 | |
72 | | | |
73 | LL | / if x == "hello" && x == "world" { | |
74 | LL | | if y == "world" && y == "hello" { | |
75 | LL | | println!("Hello world!"); | |
76 | LL | | } | |
77 | LL | | } | |
78 | | |_____^ | |
79 | | | |
80 | help: collapse nested if block | |
81 | | | |
82 | LL | if x == "hello" && x == "world" && y == "world" && y == "hello" { | |
83 | LL | println!("Hello world!"); | |
84 | LL | } | |
85 | | | |
86 | ||
87 | error: this `if` statement can be collapsed | |
88 | --> $DIR/collapsible_if.rs:39:5 | |
89 | | | |
90 | LL | / if 42 == 1337 { | |
91 | LL | | if 'a' != 'A' { | |
92 | LL | | println!("world!") | |
93 | LL | | } | |
94 | LL | | } | |
95 | | |_____^ | |
96 | | | |
97 | help: collapse nested if block | |
98 | | | |
99 | LL | if 42 == 1337 && 'a' != 'A' { | |
100 | LL | println!("world!") | |
101 | LL | } | |
102 | | | |
103 | ||
104 | error: this `if` statement can be collapsed | |
105 | --> $DIR/collapsible_if.rs:95:5 | |
106 | | | |
107 | LL | / if x == "hello" { | |
108 | LL | | if y == "world" { // Collapsible | |
109 | LL | | println!("Hello world!"); | |
110 | LL | | } | |
111 | LL | | } | |
112 | | |_____^ | |
113 | | | |
114 | help: collapse nested if block | |
115 | | | |
116 | LL | if x == "hello" && y == "world" { // Collapsible | |
117 | LL | println!("Hello world!"); | |
118 | LL | } | |
119 | | | |
120 | ||
121 | error: this `if` statement can be collapsed | |
122 | --> $DIR/collapsible_if.rs:154:5 | |
123 | | | |
124 | LL | / if matches!(true, true) { | |
125 | LL | | if matches!(true, true) {} | |
126 | LL | | } | |
127 | | |_____^ help: collapse nested if block: `if matches!(true, true) && matches!(true, true) {}` | |
128 | ||
129 | error: aborting due to 8 previous errors | |
130 |