]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/significant_drop_in_scrutinee.stderr
Rollup merge of #98441 - calebzulawski:simd_as, r=oli-obk
[rust.git] / src / tools / clippy / tests / ui / significant_drop_in_scrutinee.stderr
1 error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
2   --> $DIR/significant_drop_in_scrutinee.rs:59:11
3    |
4 LL |     match mutex.lock().unwrap().foo() {
5    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
6 LL |         true => {
7 LL |             mutex.lock().unwrap().bar();
8    |             --------------------- another value with significant `Drop` created here
9 ...
10 LL |     };
11    |      - temporary lives until here
12    |
13    = note: `-D clippy::significant-drop-in-scrutinee` implied by `-D warnings`
14    = note: this might lead to deadlocks or other unexpected behavior
15 help: try moving the temporary above the match
16    |
17 LL ~     let value = mutex.lock().unwrap().foo();
18 LL ~     match value {
19    |
20
21 error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
22   --> $DIR/significant_drop_in_scrutinee.rs:145:11
23    |
24 LL |     match s.lock_m().get_the_value() {
25    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^
26 ...
27 LL |             println!("{}", s.lock_m().get_the_value());
28    |                            ---------- another value with significant `Drop` created here
29 ...
30 LL |     }
31    |      - temporary lives until here
32    |
33    = note: this might lead to deadlocks or other unexpected behavior
34 help: try moving the temporary above the match
35    |
36 LL ~     let value = s.lock_m().get_the_value();
37 LL ~     match value {
38    |
39
40 error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
41   --> $DIR/significant_drop_in_scrutinee.rs:166:11
42    |
43 LL |     match s.lock_m_m().get_the_value() {
44    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
45 ...
46 LL |             println!("{}", s.lock_m().get_the_value());
47    |                            ---------- another value with significant `Drop` created here
48 ...
49 LL |     }
50    |      - temporary lives until here
51    |
52    = note: this might lead to deadlocks or other unexpected behavior
53 help: try moving the temporary above the match
54    |
55 LL ~     let value = s.lock_m_m().get_the_value();
56 LL ~     match value {
57    |
58
59 error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
60   --> $DIR/significant_drop_in_scrutinee.rs:214:11
61    |
62 LL |     match counter.temp_increment().len() {
63    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
64 ...
65 LL |     };
66    |      - temporary lives until here
67    |
68    = note: this might lead to deadlocks or other unexpected behavior
69 help: try moving the temporary above the match
70    |
71 LL ~     let value = counter.temp_increment().len();
72 LL ~     match value {
73    |
74
75 error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
76   --> $DIR/significant_drop_in_scrutinee.rs:237:16
77    |
78 LL |         match (mutex1.lock().unwrap().s.len(), true) {
79    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
80 ...
81 LL |                 mutex1.lock().unwrap().s.len();
82    |                 ---------------------- another value with significant `Drop` created here
83 ...
84 LL |         };
85    |          - temporary lives until here
86    |
87    = note: this might lead to deadlocks or other unexpected behavior
88 help: try moving the temporary above the match
89    |
90 LL ~         let value = mutex1.lock().unwrap().s.len();
91 LL ~         match (value, true) {
92    |
93
94 error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
95   --> $DIR/significant_drop_in_scrutinee.rs:246:22
96    |
97 LL |         match (true, mutex1.lock().unwrap().s.len(), true) {
98    |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
99 ...
100 LL |                 mutex1.lock().unwrap().s.len();
101    |                 ---------------------- another value with significant `Drop` created here
102 ...
103 LL |         };
104    |          - temporary lives until here
105    |
106    = note: this might lead to deadlocks or other unexpected behavior
107 help: try moving the temporary above the match
108    |
109 LL ~         let value = mutex1.lock().unwrap().s.len();
110 LL ~         match (true, value, true) {
111    |
112
113 error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
114   --> $DIR/significant_drop_in_scrutinee.rs:256:16
115    |
116 LL |         match (mutex1.lock().unwrap().s.len(), true, mutex2.lock().unwrap().s.len()) {
117    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
118 ...
119 LL |                 mutex1.lock().unwrap().s.len();
120    |                 ---------------------- another value with significant `Drop` created here
121 LL |                 mutex2.lock().unwrap().s.len();
122    |                 ---------------------- another value with significant `Drop` created here
123 ...
124 LL |         };
125    |          - temporary lives until here
126    |
127    = note: this might lead to deadlocks or other unexpected behavior
128 help: try moving the temporary above the match
129    |
130 LL ~         let value = mutex1.lock().unwrap().s.len();
131 LL ~         match (value, true, mutex2.lock().unwrap().s.len()) {
132    |
133
134 error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
135   --> $DIR/significant_drop_in_scrutinee.rs:256:54
136    |
137 LL |         match (mutex1.lock().unwrap().s.len(), true, mutex2.lock().unwrap().s.len()) {
138    |                                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
139 ...
140 LL |                 mutex1.lock().unwrap().s.len();
141    |                 ---------------------- another value with significant `Drop` created here
142 LL |                 mutex2.lock().unwrap().s.len();
143    |                 ---------------------- another value with significant `Drop` created here
144 ...
145 LL |         };
146    |          - temporary lives until here
147    |
148    = note: this might lead to deadlocks or other unexpected behavior
149 help: try moving the temporary above the match
150    |
151 LL ~         let value = mutex2.lock().unwrap().s.len();
152 LL ~         match (mutex1.lock().unwrap().s.len(), true, value) {
153    |
154
155 error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
156   --> $DIR/significant_drop_in_scrutinee.rs:267:15
157    |
158 LL |         match mutex3.lock().unwrap().s.as_str() {
159    |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
160 ...
161 LL |                 mutex1.lock().unwrap().s.len();
162    |                 ---------------------- another value with significant `Drop` created here
163 LL |                 mutex2.lock().unwrap().s.len();
164    |                 ---------------------- another value with significant `Drop` created here
165 ...
166 LL |         };
167    |          - temporary lives until here
168    |
169    = note: this might lead to deadlocks or other unexpected behavior
170
171 error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
172   --> $DIR/significant_drop_in_scrutinee.rs:277:22
173    |
174 LL |         match (true, mutex3.lock().unwrap().s.as_str()) {
175    |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
176 ...
177 LL |                 mutex1.lock().unwrap().s.len();
178    |                 ---------------------- another value with significant `Drop` created here
179 LL |                 mutex2.lock().unwrap().s.len();
180    |                 ---------------------- another value with significant `Drop` created here
181 ...
182 LL |         };
183    |          - temporary lives until here
184    |
185    = note: this might lead to deadlocks or other unexpected behavior
186
187 error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
188   --> $DIR/significant_drop_in_scrutinee.rs:296:11
189    |
190 LL |     match mutex.lock().unwrap().s.len() > 1 {
191    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
192 LL |         true => {
193 LL |             mutex.lock().unwrap().s.len();
194    |             --------------------- another value with significant `Drop` created here
195 ...
196 LL |     };
197    |      - temporary lives until here
198    |
199    = note: this might lead to deadlocks or other unexpected behavior
200 help: try moving the temporary above the match
201    |
202 LL ~     let value = mutex.lock().unwrap().s.len() > 1;
203 LL ~     match value {
204    |
205
206 error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
207   --> $DIR/significant_drop_in_scrutinee.rs:303:11
208    |
209 LL |     match 1 < mutex.lock().unwrap().s.len() {
210    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
211 LL |         true => {
212 LL |             mutex.lock().unwrap().s.len();
213    |             --------------------- another value with significant `Drop` created here
214 ...
215 LL |     };
216    |      - temporary lives until here
217    |
218    = note: this might lead to deadlocks or other unexpected behavior
219 help: try moving the temporary above the match
220    |
221 LL ~     let value = 1 < mutex.lock().unwrap().s.len();
222 LL ~     match value {
223    |
224
225 error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
226   --> $DIR/significant_drop_in_scrutinee.rs:321:11
227    |
228 LL |     match mutex1.lock().unwrap().s.len() < mutex2.lock().unwrap().s.len() {
229    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
230 ...
231 LL |                 mutex1.lock().unwrap().s.len(),
232    |                 ---------------------- another value with significant `Drop` created here
233 LL |                 mutex2.lock().unwrap().s.len()
234    |                 ---------------------- another value with significant `Drop` created here
235 ...
236 LL |     };
237    |      - temporary lives until here
238    |
239    = note: this might lead to deadlocks or other unexpected behavior
240 help: try moving the temporary above the match
241    |
242 LL ~     let value = mutex1.lock().unwrap().s.len() < mutex2.lock().unwrap().s.len();
243 LL ~     match value {
244    |
245
246 error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
247   --> $DIR/significant_drop_in_scrutinee.rs:332:11
248    |
249 LL |     match mutex1.lock().unwrap().s.len() >= mutex2.lock().unwrap().s.len() {
250    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
251 ...
252 LL |                 mutex1.lock().unwrap().s.len(),
253    |                 ---------------------- another value with significant `Drop` created here
254 LL |                 mutex2.lock().unwrap().s.len()
255    |                 ---------------------- another value with significant `Drop` created here
256 ...
257 LL |     };
258    |      - temporary lives until here
259    |
260    = note: this might lead to deadlocks or other unexpected behavior
261 help: try moving the temporary above the match
262    |
263 LL ~     let value = mutex1.lock().unwrap().s.len() >= mutex2.lock().unwrap().s.len();
264 LL ~     match value {
265    |
266
267 error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
268   --> $DIR/significant_drop_in_scrutinee.rs:367:11
269    |
270 LL |     match get_mutex_guard().s.len() > 1 {
271    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
272 LL |         true => {
273 LL |             mutex1.lock().unwrap().s.len();
274    |             ---------------------- another value with significant `Drop` created here
275 ...
276 LL |     };
277    |      - temporary lives until here
278    |
279    = note: this might lead to deadlocks or other unexpected behavior
280 help: try moving the temporary above the match
281    |
282 LL ~     let value = get_mutex_guard().s.len() > 1;
283 LL ~     match value {
284    |
285
286 error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
287   --> $DIR/significant_drop_in_scrutinee.rs:384:11
288    |
289 LL |       match match i {
290    |  ___________^
291 LL | |         100 => mutex1.lock().unwrap(),
292 LL | |         _ => mutex2.lock().unwrap(),
293 LL | |     }
294 LL | |     .s
295 LL | |     .len()
296 LL | |         > 1
297    | |___________^
298 ...
299 LL |               mutex1.lock().unwrap().s.len();
300    |               ---------------------- another value with significant `Drop` created here
301 ...
302 LL |       };
303    |        - temporary lives until here
304    |
305    = note: this might lead to deadlocks or other unexpected behavior
306 help: try moving the temporary above the match
307    |
308 LL ~     let value = match i {
309 LL +         100 => mutex1.lock().unwrap(),
310 LL +         _ => mutex2.lock().unwrap(),
311 LL +     }
312 LL +     .s
313 LL +     .len()
314 LL +         > 1;
315 LL ~     match value
316    |
317
318 error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
319   --> $DIR/significant_drop_in_scrutinee.rs:410:11
320    |
321 LL |       match if i > 1 {
322    |  ___________^
323 LL | |         mutex1.lock().unwrap()
324 LL | |     } else {
325 LL | |         mutex2.lock().unwrap()
326 ...  |
327 LL | |     .len()
328 LL | |         > 1
329    | |___________^
330 ...
331 LL |               mutex1.lock().unwrap().s.len();
332    |               ---------------------- another value with significant `Drop` created here
333 ...
334 LL |       };
335    |        - temporary lives until here
336    |
337    = note: this might lead to deadlocks or other unexpected behavior
338 help: try moving the temporary above the match
339    |
340 LL ~     let value = if i > 1 {
341 LL +         mutex1.lock().unwrap()
342 LL +     } else {
343 LL +         mutex2.lock().unwrap()
344 LL +     }
345 LL +     .s
346 LL +     .len()
347 LL +         > 1;
348 LL ~     match value
349    |
350
351 error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
352   --> $DIR/significant_drop_in_scrutinee.rs:464:11
353    |
354 LL |     match s.lock().deref().deref() {
355    |           ^^^^^^^^^^^^^^^^^^^^^^^^
356 LL |         0 | 1 => println!("Value was less than 2"),
357 LL |         _ => println!("Value is {}", s.lock().deref()),
358    |                                      ---------------- another value with significant `Drop` created here
359 LL |     };
360    |      - temporary lives until here
361    |
362    = note: this might lead to deadlocks or other unexpected behavior
363 help: try moving the temporary above the match and create a copy
364    |
365 LL ~     let value = *s.lock().deref().deref();
366 LL ~     match value {
367    |
368
369 error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
370   --> $DIR/significant_drop_in_scrutinee.rs:492:11
371    |
372 LL |     match s.lock().deref().deref() {
373    |           ^^^^^^^^^^^^^^^^^^^^^^^^
374 LL |         matcher => println!("Value is {}", s.lock().deref()),
375    |                                            ---------------- another value with significant `Drop` created here
376 LL |         _ => println!("Value was not a match"),
377 LL |     };
378    |      - temporary lives until here
379    |
380    = note: this might lead to deadlocks or other unexpected behavior
381
382 error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
383   --> $DIR/significant_drop_in_scrutinee.rs:511:11
384    |
385 LL |     match mutex.lock().unwrap().i = i {
386    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
387 LL |         _ => {
388 LL |             println!("{}", mutex.lock().unwrap().i);
389    |                            --------------------- another value with significant `Drop` created here
390 LL |         },
391 LL |     };
392    |      - temporary lives until here
393    |
394    = note: this might lead to deadlocks or other unexpected behavior
395 help: try moving the temporary above the match
396    |
397 LL ~     mutex.lock().unwrap().i = i;
398 LL ~     match () {
399    |
400
401 error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
402   --> $DIR/significant_drop_in_scrutinee.rs:517:11
403    |
404 LL |     match i = mutex.lock().unwrap().i {
405    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
406 LL |         _ => {
407 LL |             println!("{}", mutex.lock().unwrap().i);
408    |                            --------------------- another value with significant `Drop` created here
409 LL |         },
410 LL |     };
411    |      - temporary lives until here
412    |
413    = note: this might lead to deadlocks or other unexpected behavior
414 help: try moving the temporary above the match
415    |
416 LL ~     i = mutex.lock().unwrap().i;
417 LL ~     match () {
418    |
419
420 error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
421   --> $DIR/significant_drop_in_scrutinee.rs:523:11
422    |
423 LL |     match mutex.lock().unwrap().i += 1 {
424    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
425 LL |         _ => {
426 LL |             println!("{}", mutex.lock().unwrap().i);
427    |                            --------------------- another value with significant `Drop` created here
428 LL |         },
429 LL |     };
430    |      - temporary lives until here
431    |
432    = note: this might lead to deadlocks or other unexpected behavior
433 help: try moving the temporary above the match
434    |
435 LL ~     mutex.lock().unwrap().i += 1;
436 LL ~     match () {
437    |
438
439 error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
440   --> $DIR/significant_drop_in_scrutinee.rs:529:11
441    |
442 LL |     match i += mutex.lock().unwrap().i {
443    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
444 LL |         _ => {
445 LL |             println!("{}", mutex.lock().unwrap().i);
446    |                            --------------------- another value with significant `Drop` created here
447 LL |         },
448 LL |     };
449    |      - temporary lives until here
450    |
451    = note: this might lead to deadlocks or other unexpected behavior
452 help: try moving the temporary above the match
453    |
454 LL ~     i += mutex.lock().unwrap().i;
455 LL ~     match () {
456    |
457
458 error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
459   --> $DIR/significant_drop_in_scrutinee.rs:592:11
460    |
461 LL |     match rwlock.read().unwrap().to_number() {
462    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
463 ...
464 LL |     };
465    |      - temporary lives until here
466    |
467    = note: this might lead to deadlocks or other unexpected behavior
468
469 error: temporary with significant `Drop` in `for` loop condition will live until the end of the `for` expression
470   --> $DIR/significant_drop_in_scrutinee.rs:602:14
471    |
472 LL |     for s in rwlock.read().unwrap().iter() {
473    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
474 LL |         println!("{}", s);
475 LL |     }
476    |      - temporary lives until here
477    |
478    = note: this might lead to deadlocks or other unexpected behavior
479
480 error: temporary with significant `Drop` in `match` scrutinee will live until the end of the `match` expression
481   --> $DIR/significant_drop_in_scrutinee.rs:617:11
482    |
483 LL |     match mutex.lock().unwrap().foo() {
484    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
485 ...
486 LL |     };
487    |      - temporary lives until here
488    |
489    = note: this might lead to deadlocks or other unexpected behavior
490 help: try moving the temporary above the match
491    |
492 LL ~     let value = mutex.lock().unwrap().foo();
493 LL ~     match value {
494    |
495
496 error: aborting due to 26 previous errors
497