]> git.proxmox.com Git - rustc.git/blob - src/tools/clippy/tests/ui/unnecessary_to_owned.stderr
New upstream version 1.67.1+dfsg1
[rustc.git] / src / tools / clippy / tests / ui / unnecessary_to_owned.stderr
1 error: redundant clone
2 --> $DIR/unnecessary_to_owned.rs:150:64
3 |
4 LL | require_c_str(&CString::from_vec_with_nul(vec![0]).unwrap().to_owned());
5 | ^^^^^^^^^^^ help: remove this
6 |
7 note: this value is dropped without further use
8 --> $DIR/unnecessary_to_owned.rs:150:20
9 |
10 LL | require_c_str(&CString::from_vec_with_nul(vec![0]).unwrap().to_owned());
11 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12 = note: `-D clippy::redundant-clone` implied by `-D warnings`
13
14 error: redundant clone
15 --> $DIR/unnecessary_to_owned.rs:151:40
16 |
17 LL | require_os_str(&OsString::from("x").to_os_string());
18 | ^^^^^^^^^^^^^^^ help: remove this
19 |
20 note: this value is dropped without further use
21 --> $DIR/unnecessary_to_owned.rs:151:21
22 |
23 LL | require_os_str(&OsString::from("x").to_os_string());
24 | ^^^^^^^^^^^^^^^^^^^
25
26 error: redundant clone
27 --> $DIR/unnecessary_to_owned.rs:152:48
28 |
29 LL | require_path(&std::path::PathBuf::from("x").to_path_buf());
30 | ^^^^^^^^^^^^^^ help: remove this
31 |
32 note: this value is dropped without further use
33 --> $DIR/unnecessary_to_owned.rs:152:19
34 |
35 LL | require_path(&std::path::PathBuf::from("x").to_path_buf());
36 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
37
38 error: redundant clone
39 --> $DIR/unnecessary_to_owned.rs:153:35
40 |
41 LL | require_str(&String::from("x").to_string());
42 | ^^^^^^^^^^^^ help: remove this
43 |
44 note: this value is dropped without further use
45 --> $DIR/unnecessary_to_owned.rs:153:18
46 |
47 LL | require_str(&String::from("x").to_string());
48 | ^^^^^^^^^^^^^^^^^
49
50 error: redundant clone
51 --> $DIR/unnecessary_to_owned.rs:154:39
52 |
53 LL | require_slice(&[String::from("x")].to_owned());
54 | ^^^^^^^^^^^ help: remove this
55 |
56 note: this value is dropped without further use
57 --> $DIR/unnecessary_to_owned.rs:154:20
58 |
59 LL | require_slice(&[String::from("x")].to_owned());
60 | ^^^^^^^^^^^^^^^^^^^
61
62 error: unnecessary use of `into_owned`
63 --> $DIR/unnecessary_to_owned.rs:59:36
64 |
65 LL | require_c_str(&Cow::from(c_str).into_owned());
66 | ^^^^^^^^^^^^^ help: remove this
67 |
68 = note: `-D clippy::unnecessary-to-owned` implied by `-D warnings`
69
70 error: unnecessary use of `to_owned`
71 --> $DIR/unnecessary_to_owned.rs:60:19
72 |
73 LL | require_c_str(&c_str.to_owned());
74 | ^^^^^^^^^^^^^^^^^ help: use: `c_str`
75
76 error: unnecessary use of `to_os_string`
77 --> $DIR/unnecessary_to_owned.rs:62:20
78 |
79 LL | require_os_str(&os_str.to_os_string());
80 | ^^^^^^^^^^^^^^^^^^^^^^ help: use: `os_str`
81
82 error: unnecessary use of `into_owned`
83 --> $DIR/unnecessary_to_owned.rs:63:38
84 |
85 LL | require_os_str(&Cow::from(os_str).into_owned());
86 | ^^^^^^^^^^^^^ help: remove this
87
88 error: unnecessary use of `to_owned`
89 --> $DIR/unnecessary_to_owned.rs:64:20
90 |
91 LL | require_os_str(&os_str.to_owned());
92 | ^^^^^^^^^^^^^^^^^^ help: use: `os_str`
93
94 error: unnecessary use of `to_path_buf`
95 --> $DIR/unnecessary_to_owned.rs:66:18
96 |
97 LL | require_path(&path.to_path_buf());
98 | ^^^^^^^^^^^^^^^^^^^ help: use: `path`
99
100 error: unnecessary use of `into_owned`
101 --> $DIR/unnecessary_to_owned.rs:67:34
102 |
103 LL | require_path(&Cow::from(path).into_owned());
104 | ^^^^^^^^^^^^^ help: remove this
105
106 error: unnecessary use of `to_owned`
107 --> $DIR/unnecessary_to_owned.rs:68:18
108 |
109 LL | require_path(&path.to_owned());
110 | ^^^^^^^^^^^^^^^^ help: use: `path`
111
112 error: unnecessary use of `to_string`
113 --> $DIR/unnecessary_to_owned.rs:70:17
114 |
115 LL | require_str(&s.to_string());
116 | ^^^^^^^^^^^^^^ help: use: `s`
117
118 error: unnecessary use of `into_owned`
119 --> $DIR/unnecessary_to_owned.rs:71:30
120 |
121 LL | require_str(&Cow::from(s).into_owned());
122 | ^^^^^^^^^^^^^ help: remove this
123
124 error: unnecessary use of `to_owned`
125 --> $DIR/unnecessary_to_owned.rs:72:17
126 |
127 LL | require_str(&s.to_owned());
128 | ^^^^^^^^^^^^^ help: use: `s`
129
130 error: unnecessary use of `to_string`
131 --> $DIR/unnecessary_to_owned.rs:73:17
132 |
133 LL | require_str(&x_ref.to_string());
134 | ^^^^^^^^^^^^^^^^^^ help: use: `x_ref.as_ref()`
135
136 error: unnecessary use of `to_vec`
137 --> $DIR/unnecessary_to_owned.rs:75:19
138 |
139 LL | require_slice(&slice.to_vec());
140 | ^^^^^^^^^^^^^^^ help: use: `slice`
141
142 error: unnecessary use of `into_owned`
143 --> $DIR/unnecessary_to_owned.rs:76:36
144 |
145 LL | require_slice(&Cow::from(slice).into_owned());
146 | ^^^^^^^^^^^^^ help: remove this
147
148 error: unnecessary use of `to_owned`
149 --> $DIR/unnecessary_to_owned.rs:77:19
150 |
151 LL | require_slice(&array.to_owned());
152 | ^^^^^^^^^^^^^^^^^ help: use: `array.as_ref()`
153
154 error: unnecessary use of `to_owned`
155 --> $DIR/unnecessary_to_owned.rs:78:19
156 |
157 LL | require_slice(&array_ref.to_owned());
158 | ^^^^^^^^^^^^^^^^^^^^^ help: use: `array_ref.as_ref()`
159
160 error: unnecessary use of `to_owned`
161 --> $DIR/unnecessary_to_owned.rs:79:19
162 |
163 LL | require_slice(&slice.to_owned());
164 | ^^^^^^^^^^^^^^^^^ help: use: `slice`
165
166 error: unnecessary use of `into_owned`
167 --> $DIR/unnecessary_to_owned.rs:82:42
168 |
169 LL | require_x(&Cow::<X>::Owned(x.clone()).into_owned());
170 | ^^^^^^^^^^^^^ help: remove this
171
172 error: unnecessary use of `to_owned`
173 --> $DIR/unnecessary_to_owned.rs:85:25
174 |
175 LL | require_deref_c_str(c_str.to_owned());
176 | ^^^^^^^^^^^^^^^^ help: use: `c_str`
177
178 error: unnecessary use of `to_owned`
179 --> $DIR/unnecessary_to_owned.rs:86:26
180 |
181 LL | require_deref_os_str(os_str.to_owned());
182 | ^^^^^^^^^^^^^^^^^ help: use: `os_str`
183
184 error: unnecessary use of `to_owned`
185 --> $DIR/unnecessary_to_owned.rs:87:24
186 |
187 LL | require_deref_path(path.to_owned());
188 | ^^^^^^^^^^^^^^^ help: use: `path`
189
190 error: unnecessary use of `to_owned`
191 --> $DIR/unnecessary_to_owned.rs:88:23
192 |
193 LL | require_deref_str(s.to_owned());
194 | ^^^^^^^^^^^^ help: use: `s`
195
196 error: unnecessary use of `to_owned`
197 --> $DIR/unnecessary_to_owned.rs:89:25
198 |
199 LL | require_deref_slice(slice.to_owned());
200 | ^^^^^^^^^^^^^^^^ help: use: `slice`
201
202 error: unnecessary use of `to_owned`
203 --> $DIR/unnecessary_to_owned.rs:91:30
204 |
205 LL | require_impl_deref_c_str(c_str.to_owned());
206 | ^^^^^^^^^^^^^^^^ help: use: `c_str`
207
208 error: unnecessary use of `to_owned`
209 --> $DIR/unnecessary_to_owned.rs:92:31
210 |
211 LL | require_impl_deref_os_str(os_str.to_owned());
212 | ^^^^^^^^^^^^^^^^^ help: use: `os_str`
213
214 error: unnecessary use of `to_owned`
215 --> $DIR/unnecessary_to_owned.rs:93:29
216 |
217 LL | require_impl_deref_path(path.to_owned());
218 | ^^^^^^^^^^^^^^^ help: use: `path`
219
220 error: unnecessary use of `to_owned`
221 --> $DIR/unnecessary_to_owned.rs:94:28
222 |
223 LL | require_impl_deref_str(s.to_owned());
224 | ^^^^^^^^^^^^ help: use: `s`
225
226 error: unnecessary use of `to_owned`
227 --> $DIR/unnecessary_to_owned.rs:95:30
228 |
229 LL | require_impl_deref_slice(slice.to_owned());
230 | ^^^^^^^^^^^^^^^^ help: use: `slice`
231
232 error: unnecessary use of `to_owned`
233 --> $DIR/unnecessary_to_owned.rs:97:29
234 |
235 LL | require_deref_str_slice(s.to_owned(), slice.to_owned());
236 | ^^^^^^^^^^^^ help: use: `s`
237
238 error: unnecessary use of `to_owned`
239 --> $DIR/unnecessary_to_owned.rs:97:43
240 |
241 LL | require_deref_str_slice(s.to_owned(), slice.to_owned());
242 | ^^^^^^^^^^^^^^^^ help: use: `slice`
243
244 error: unnecessary use of `to_owned`
245 --> $DIR/unnecessary_to_owned.rs:98:29
246 |
247 LL | require_deref_slice_str(slice.to_owned(), s.to_owned());
248 | ^^^^^^^^^^^^^^^^ help: use: `slice`
249
250 error: unnecessary use of `to_owned`
251 --> $DIR/unnecessary_to_owned.rs:98:47
252 |
253 LL | require_deref_slice_str(slice.to_owned(), s.to_owned());
254 | ^^^^^^^^^^^^ help: use: `s`
255
256 error: unnecessary use of `to_owned`
257 --> $DIR/unnecessary_to_owned.rs:100:26
258 |
259 LL | require_as_ref_c_str(c_str.to_owned());
260 | ^^^^^^^^^^^^^^^^ help: use: `c_str`
261
262 error: unnecessary use of `to_owned`
263 --> $DIR/unnecessary_to_owned.rs:101:27
264 |
265 LL | require_as_ref_os_str(os_str.to_owned());
266 | ^^^^^^^^^^^^^^^^^ help: use: `os_str`
267
268 error: unnecessary use of `to_owned`
269 --> $DIR/unnecessary_to_owned.rs:102:25
270 |
271 LL | require_as_ref_path(path.to_owned());
272 | ^^^^^^^^^^^^^^^ help: use: `path`
273
274 error: unnecessary use of `to_owned`
275 --> $DIR/unnecessary_to_owned.rs:103:24
276 |
277 LL | require_as_ref_str(s.to_owned());
278 | ^^^^^^^^^^^^ help: use: `s`
279
280 error: unnecessary use of `to_owned`
281 --> $DIR/unnecessary_to_owned.rs:104:24
282 |
283 LL | require_as_ref_str(x.to_owned());
284 | ^^^^^^^^^^^^ help: use: `&x`
285
286 error: unnecessary use of `to_owned`
287 --> $DIR/unnecessary_to_owned.rs:105:26
288 |
289 LL | require_as_ref_slice(array.to_owned());
290 | ^^^^^^^^^^^^^^^^ help: use: `array`
291
292 error: unnecessary use of `to_owned`
293 --> $DIR/unnecessary_to_owned.rs:106:26
294 |
295 LL | require_as_ref_slice(array_ref.to_owned());
296 | ^^^^^^^^^^^^^^^^^^^^ help: use: `array_ref`
297
298 error: unnecessary use of `to_owned`
299 --> $DIR/unnecessary_to_owned.rs:107:26
300 |
301 LL | require_as_ref_slice(slice.to_owned());
302 | ^^^^^^^^^^^^^^^^ help: use: `slice`
303
304 error: unnecessary use of `to_owned`
305 --> $DIR/unnecessary_to_owned.rs:109:31
306 |
307 LL | require_impl_as_ref_c_str(c_str.to_owned());
308 | ^^^^^^^^^^^^^^^^ help: use: `c_str`
309
310 error: unnecessary use of `to_owned`
311 --> $DIR/unnecessary_to_owned.rs:110:32
312 |
313 LL | require_impl_as_ref_os_str(os_str.to_owned());
314 | ^^^^^^^^^^^^^^^^^ help: use: `os_str`
315
316 error: unnecessary use of `to_owned`
317 --> $DIR/unnecessary_to_owned.rs:111:30
318 |
319 LL | require_impl_as_ref_path(path.to_owned());
320 | ^^^^^^^^^^^^^^^ help: use: `path`
321
322 error: unnecessary use of `to_owned`
323 --> $DIR/unnecessary_to_owned.rs:112:29
324 |
325 LL | require_impl_as_ref_str(s.to_owned());
326 | ^^^^^^^^^^^^ help: use: `s`
327
328 error: unnecessary use of `to_owned`
329 --> $DIR/unnecessary_to_owned.rs:113:29
330 |
331 LL | require_impl_as_ref_str(x.to_owned());
332 | ^^^^^^^^^^^^ help: use: `&x`
333
334 error: unnecessary use of `to_owned`
335 --> $DIR/unnecessary_to_owned.rs:114:31
336 |
337 LL | require_impl_as_ref_slice(array.to_owned());
338 | ^^^^^^^^^^^^^^^^ help: use: `array`
339
340 error: unnecessary use of `to_owned`
341 --> $DIR/unnecessary_to_owned.rs:115:31
342 |
343 LL | require_impl_as_ref_slice(array_ref.to_owned());
344 | ^^^^^^^^^^^^^^^^^^^^ help: use: `array_ref`
345
346 error: unnecessary use of `to_owned`
347 --> $DIR/unnecessary_to_owned.rs:116:31
348 |
349 LL | require_impl_as_ref_slice(slice.to_owned());
350 | ^^^^^^^^^^^^^^^^ help: use: `slice`
351
352 error: unnecessary use of `to_owned`
353 --> $DIR/unnecessary_to_owned.rs:118:30
354 |
355 LL | require_as_ref_str_slice(s.to_owned(), array.to_owned());
356 | ^^^^^^^^^^^^ help: use: `s`
357
358 error: unnecessary use of `to_owned`
359 --> $DIR/unnecessary_to_owned.rs:118:44
360 |
361 LL | require_as_ref_str_slice(s.to_owned(), array.to_owned());
362 | ^^^^^^^^^^^^^^^^ help: use: `array`
363
364 error: unnecessary use of `to_owned`
365 --> $DIR/unnecessary_to_owned.rs:119:30
366 |
367 LL | require_as_ref_str_slice(s.to_owned(), array_ref.to_owned());
368 | ^^^^^^^^^^^^ help: use: `s`
369
370 error: unnecessary use of `to_owned`
371 --> $DIR/unnecessary_to_owned.rs:119:44
372 |
373 LL | require_as_ref_str_slice(s.to_owned(), array_ref.to_owned());
374 | ^^^^^^^^^^^^^^^^^^^^ help: use: `array_ref`
375
376 error: unnecessary use of `to_owned`
377 --> $DIR/unnecessary_to_owned.rs:120:30
378 |
379 LL | require_as_ref_str_slice(s.to_owned(), slice.to_owned());
380 | ^^^^^^^^^^^^ help: use: `s`
381
382 error: unnecessary use of `to_owned`
383 --> $DIR/unnecessary_to_owned.rs:120:44
384 |
385 LL | require_as_ref_str_slice(s.to_owned(), slice.to_owned());
386 | ^^^^^^^^^^^^^^^^ help: use: `slice`
387
388 error: unnecessary use of `to_owned`
389 --> $DIR/unnecessary_to_owned.rs:121:30
390 |
391 LL | require_as_ref_slice_str(array.to_owned(), s.to_owned());
392 | ^^^^^^^^^^^^^^^^ help: use: `array`
393
394 error: unnecessary use of `to_owned`
395 --> $DIR/unnecessary_to_owned.rs:121:48
396 |
397 LL | require_as_ref_slice_str(array.to_owned(), s.to_owned());
398 | ^^^^^^^^^^^^ help: use: `s`
399
400 error: unnecessary use of `to_owned`
401 --> $DIR/unnecessary_to_owned.rs:122:30
402 |
403 LL | require_as_ref_slice_str(array_ref.to_owned(), s.to_owned());
404 | ^^^^^^^^^^^^^^^^^^^^ help: use: `array_ref`
405
406 error: unnecessary use of `to_owned`
407 --> $DIR/unnecessary_to_owned.rs:122:52
408 |
409 LL | require_as_ref_slice_str(array_ref.to_owned(), s.to_owned());
410 | ^^^^^^^^^^^^ help: use: `s`
411
412 error: unnecessary use of `to_owned`
413 --> $DIR/unnecessary_to_owned.rs:123:30
414 |
415 LL | require_as_ref_slice_str(slice.to_owned(), s.to_owned());
416 | ^^^^^^^^^^^^^^^^ help: use: `slice`
417
418 error: unnecessary use of `to_owned`
419 --> $DIR/unnecessary_to_owned.rs:123:48
420 |
421 LL | require_as_ref_slice_str(slice.to_owned(), s.to_owned());
422 | ^^^^^^^^^^^^ help: use: `s`
423
424 error: unnecessary use of `to_string`
425 --> $DIR/unnecessary_to_owned.rs:125:20
426 |
427 LL | let _ = x.join(&x_ref.to_string());
428 | ^^^^^^^^^^^^^^^^^^ help: use: `x_ref`
429
430 error: unnecessary use of `to_vec`
431 --> $DIR/unnecessary_to_owned.rs:127:13
432 |
433 LL | let _ = slice.to_vec().into_iter();
434 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `slice.iter().copied()`
435
436 error: unnecessary use of `to_owned`
437 --> $DIR/unnecessary_to_owned.rs:128:13
438 |
439 LL | let _ = slice.to_owned().into_iter();
440 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `slice.iter().copied()`
441
442 error: unnecessary use of `to_vec`
443 --> $DIR/unnecessary_to_owned.rs:129:13
444 |
445 LL | let _ = [std::path::PathBuf::new()][..].to_vec().into_iter();
446 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `[std::path::PathBuf::new()][..].iter().cloned()`
447
448 error: unnecessary use of `to_owned`
449 --> $DIR/unnecessary_to_owned.rs:130:13
450 |
451 LL | let _ = [std::path::PathBuf::new()][..].to_owned().into_iter();
452 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `[std::path::PathBuf::new()][..].iter().cloned()`
453
454 error: unnecessary use of `to_vec`
455 --> $DIR/unnecessary_to_owned.rs:132:13
456 |
457 LL | let _ = IntoIterator::into_iter(slice.to_vec());
458 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `slice.iter().copied()`
459
460 error: unnecessary use of `to_owned`
461 --> $DIR/unnecessary_to_owned.rs:133:13
462 |
463 LL | let _ = IntoIterator::into_iter(slice.to_owned());
464 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `slice.iter().copied()`
465
466 error: unnecessary use of `to_vec`
467 --> $DIR/unnecessary_to_owned.rs:134:13
468 |
469 LL | let _ = IntoIterator::into_iter([std::path::PathBuf::new()][..].to_vec());
470 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `[std::path::PathBuf::new()][..].iter().cloned()`
471
472 error: unnecessary use of `to_owned`
473 --> $DIR/unnecessary_to_owned.rs:135:13
474 |
475 LL | let _ = IntoIterator::into_iter([std::path::PathBuf::new()][..].to_owned());
476 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `[std::path::PathBuf::new()][..].iter().cloned()`
477
478 error: unnecessary use of `to_vec`
479 --> $DIR/unnecessary_to_owned.rs:197:14
480 |
481 LL | for t in file_types.to_vec() {
482 | ^^^^^^^^^^^^^^^^^^^
483 |
484 help: use
485 |
486 LL | for t in file_types {
487 | ~~~~~~~~~~
488 help: remove this `&`
489 |
490 LL - let path = match get_file_path(&t) {
491 LL + let path = match get_file_path(t) {
492 |
493
494 error: unnecessary use of `to_vec`
495 --> $DIR/unnecessary_to_owned.rs:220:14
496 |
497 LL | let _ = &["x"][..].to_vec().into_iter();
498 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `["x"][..].iter().cloned()`
499
500 error: unnecessary use of `to_vec`
501 --> $DIR/unnecessary_to_owned.rs:225:14
502 |
503 LL | let _ = &["x"][..].to_vec().into_iter();
504 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `["x"][..].iter().copied()`
505
506 error: unnecessary use of `to_string`
507 --> $DIR/unnecessary_to_owned.rs:272:24
508 |
509 LL | Box::new(build(y.to_string()))
510 | ^^^^^^^^^^^^^ help: use: `y`
511
512 error: unnecessary use of `to_string`
513 --> $DIR/unnecessary_to_owned.rs:380:12
514 |
515 LL | id("abc".to_string())
516 | ^^^^^^^^^^^^^^^^^ help: use: `"abc"`
517
518 error: aborting due to 79 previous errors
519