]> git.lizzy.rs Git - rust.git/blob - tests/ui/if_same_then_else.stderr
Auto merge of #4478 - tsurai:master, r=flip1995
[rust.git] / tests / ui / if_same_then_else.stderr
1 error: this `if` has identical blocks
2   --> $DIR/if_same_then_else.rs:31:12
3    |
4 LL |       } else {
5    |  ____________^
6 LL | |         //~ ERROR same body as `if` block
7 LL | |         Foo { bar: 42 };
8 LL | |         0..10;
9 ...  |
10 LL | |         foo();
11 LL | |     }
12    | |_____^
13    |
14    = note: `-D clippy::if-same-then-else` implied by `-D warnings`
15 note: same as this
16   --> $DIR/if_same_then_else.rs:23:13
17    |
18 LL |       if true {
19    |  _____________^
20 LL | |         Foo { bar: 42 };
21 LL | |         0..10;
22 LL | |         ..;
23 ...  |
24 LL | |         foo();
25 LL | |     } else {
26    | |_____^
27
28 error: this `if` has identical blocks
29   --> $DIR/if_same_then_else.rs:69:12
30    |
31 LL |       } else {
32    |  ____________^
33 LL | |         //~ ERROR same body as `if` block
34 LL | |         0.0
35 LL | |     };
36    | |_____^
37    |
38 note: same as this
39   --> $DIR/if_same_then_else.rs:67:21
40    |
41 LL |       let _ = if true {
42    |  _____________________^
43 LL | |         0.0
44 LL | |     } else {
45    | |_____^
46
47 error: this `if` has identical blocks
48   --> $DIR/if_same_then_else.rs:76:12
49    |
50 LL |       } else {
51    |  ____________^
52 LL | |         //~ ERROR same body as `if` block
53 LL | |         -0.0
54 LL | |     };
55    | |_____^
56    |
57 note: same as this
58   --> $DIR/if_same_then_else.rs:74:21
59    |
60 LL |       let _ = if true {
61    |  _____________________^
62 LL | |         -0.0
63 LL | |     } else {
64    | |_____^
65
66 error: this `if` has identical blocks
67   --> $DIR/if_same_then_else.rs:92:12
68    |
69 LL |       } else {
70    |  ____________^
71 LL | |         //~ ERROR same body as `if` block
72 LL | |         42
73 LL | |     };
74    | |_____^
75    |
76 note: same as this
77   --> $DIR/if_same_then_else.rs:90:21
78    |
79 LL |       let _ = if true {
80    |  _____________________^
81 LL | |         42
82 LL | |     } else {
83    | |_____^
84
85 error: this `if` has identical blocks
86   --> $DIR/if_same_then_else.rs:106:12
87    |
88 LL |       } else {
89    |  ____________^
90 LL | |         //~ ERROR same body as `if` block
91 LL | |         for _ in &[42] {
92 LL | |             let foo: &Option<_> = &Some::<u8>(42);
93 ...  |
94 LL | |         }
95 LL | |     }
96    | |_____^
97    |
98 note: same as this
99   --> $DIR/if_same_then_else.rs:97:13
100    |
101 LL |       if true {
102    |  _____________^
103 LL | |         for _ in &[42] {
104 LL | |             let foo: &Option<_> = &Some::<u8>(42);
105 LL | |             if true {
106 ...  |
107 LL | |         }
108 LL | |     } else {
109    | |_____^
110
111 error: this `if` has identical blocks
112   --> $DIR/if_same_then_else.rs:125:12
113    |
114 LL |       } else {
115    |  ____________^
116 LL | |         //~ ERROR same body as `if` block
117 LL | |         let bar = if true { 42 } else { 43 };
118 LL | |
119 ...  |
120 LL | |         bar + 1;
121 LL | |     }
122    | |_____^
123    |
124 note: same as this
125   --> $DIR/if_same_then_else.rs:118:13
126    |
127 LL |       if true {
128    |  _____________^
129 LL | |         let bar = if true { 42 } else { 43 };
130 LL | |
131 LL | |         while foo() {
132 ...  |
133 LL | |         bar + 1;
134 LL | |     } else {
135    | |_____^
136
137 error: this `if` has identical blocks
138   --> $DIR/if_same_then_else.rs:155:12
139    |
140 LL |       } else {
141    |  ____________^
142 LL | |         //~ ERROR same body as `if` block
143 LL | |         if let Some(a) = Some(42) {}
144 LL | |     }
145    | |_____^
146    |
147 note: same as this
148   --> $DIR/if_same_then_else.rs:153:13
149    |
150 LL |       if true {
151    |  _____________^
152 LL | |         if let Some(a) = Some(42) {}
153 LL | |     } else {
154    | |_____^
155
156 error: this `if` has identical blocks
157   --> $DIR/if_same_then_else.rs:162:12
158    |
159 LL |       } else {
160    |  ____________^
161 LL | |         //~ ERROR same body as `if` block
162 LL | |         if let (1, .., 3) = (1, 2, 3) {}
163 LL | |     }
164    | |_____^
165    |
166 note: same as this
167   --> $DIR/if_same_then_else.rs:160:13
168    |
169 LL |       if true {
170    |  _____________^
171 LL | |         if let (1, .., 3) = (1, 2, 3) {}
172 LL | |     } else {
173    | |_____^
174
175 error: this `if` has identical blocks
176   --> $DIR/if_same_then_else.rs:212:12
177    |
178 LL |       } else {
179    |  ____________^
180 LL | |         //~ ERROR same body as `if` block
181 LL | |         std::f32::NAN
182 LL | |     };
183    | |_____^
184    |
185 note: same as this
186   --> $DIR/if_same_then_else.rs:210:21
187    |
188 LL |       let _ = if true {
189    |  _____________________^
190 LL | |         std::f32::NAN
191 LL | |     } else {
192    | |_____^
193
194 error: this `if` has identical blocks
195   --> $DIR/if_same_then_else.rs:219:12
196    |
197 LL |       } else {
198    |  ____________^
199 LL | |         //~ ERROR same body as `if` block
200 LL | |         Ok("foo")?;
201 LL | |     }
202    | |_____^
203    |
204 note: same as this
205   --> $DIR/if_same_then_else.rs:217:13
206    |
207 LL |       if true {
208    |  _____________^
209 LL | |         Ok("foo")?;
210 LL | |     } else {
211    | |_____^
212
213 error: this `if` has identical blocks
214   --> $DIR/if_same_then_else.rs:244:12
215    |
216 LL |       } else {
217    |  ____________^
218 LL | |         let foo = "";
219 LL | |         return Ok(&foo[0..]);
220 LL | |     }
221    | |_____^
222    |
223 note: same as this
224   --> $DIR/if_same_then_else.rs:241:20
225    |
226 LL |       } else if true {
227    |  ____________________^
228 LL | |         let foo = "";
229 LL | |         return Ok(&foo[0..]);
230 LL | |     } else {
231    | |_____^
232
233 error: this `if` has the same condition as a previous if
234   --> $DIR/if_same_then_else.rs:241:15
235    |
236 LL |     } else if true {
237    |               ^^^^
238    |
239    = note: `#[deny(clippy::ifs_same_cond)]` on by default
240 note: same as this
241   --> $DIR/if_same_then_else.rs:235:8
242    |
243 LL |     if true {
244    |        ^^^^
245
246 error: aborting due to 12 previous errors
247