]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/unnecessary_to_owned.stderr
Merge commit 'd0cf3481a84e3aa68c2f185c460e282af36ebc42' into clippyup
[rust.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: `-D clippy::redundant-clone` implied by `-D warnings`
8 note: this value is dropped without further use
9   --> $DIR/unnecessary_to_owned.rs:150:20
10    |
11 LL |     require_c_str(&CString::from_vec_with_nul(vec![0]).unwrap().to_owned());
12    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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: unnecessary use of `into_owned`
51   --> $DIR/unnecessary_to_owned.rs:59:36
52    |
53 LL |     require_c_str(&Cow::from(c_str).into_owned());
54    |                                    ^^^^^^^^^^^^^ help: remove this
55    |
56    = note: `-D clippy::unnecessary-to-owned` implied by `-D warnings`
57
58 error: unnecessary use of `to_owned`
59   --> $DIR/unnecessary_to_owned.rs:60:19
60    |
61 LL |     require_c_str(&c_str.to_owned());
62    |                   ^^^^^^^^^^^^^^^^^ help: use: `c_str`
63
64 error: unnecessary use of `to_os_string`
65   --> $DIR/unnecessary_to_owned.rs:62:20
66    |
67 LL |     require_os_str(&os_str.to_os_string());
68    |                    ^^^^^^^^^^^^^^^^^^^^^^ help: use: `os_str`
69
70 error: unnecessary use of `into_owned`
71   --> $DIR/unnecessary_to_owned.rs:63:38
72    |
73 LL |     require_os_str(&Cow::from(os_str).into_owned());
74    |                                      ^^^^^^^^^^^^^ help: remove this
75
76 error: unnecessary use of `to_owned`
77   --> $DIR/unnecessary_to_owned.rs:64:20
78    |
79 LL |     require_os_str(&os_str.to_owned());
80    |                    ^^^^^^^^^^^^^^^^^^ help: use: `os_str`
81
82 error: unnecessary use of `to_path_buf`
83   --> $DIR/unnecessary_to_owned.rs:66:18
84    |
85 LL |     require_path(&path.to_path_buf());
86    |                  ^^^^^^^^^^^^^^^^^^^ help: use: `path`
87
88 error: unnecessary use of `into_owned`
89   --> $DIR/unnecessary_to_owned.rs:67:34
90    |
91 LL |     require_path(&Cow::from(path).into_owned());
92    |                                  ^^^^^^^^^^^^^ help: remove this
93
94 error: unnecessary use of `to_owned`
95   --> $DIR/unnecessary_to_owned.rs:68:18
96    |
97 LL |     require_path(&path.to_owned());
98    |                  ^^^^^^^^^^^^^^^^ help: use: `path`
99
100 error: unnecessary use of `to_string`
101   --> $DIR/unnecessary_to_owned.rs:70:17
102    |
103 LL |     require_str(&s.to_string());
104    |                 ^^^^^^^^^^^^^^ help: use: `s`
105
106 error: unnecessary use of `into_owned`
107   --> $DIR/unnecessary_to_owned.rs:71:30
108    |
109 LL |     require_str(&Cow::from(s).into_owned());
110    |                              ^^^^^^^^^^^^^ help: remove this
111
112 error: unnecessary use of `to_owned`
113   --> $DIR/unnecessary_to_owned.rs:72:17
114    |
115 LL |     require_str(&s.to_owned());
116    |                 ^^^^^^^^^^^^^ help: use: `s`
117
118 error: unnecessary use of `to_string`
119   --> $DIR/unnecessary_to_owned.rs:73:17
120    |
121 LL |     require_str(&x_ref.to_string());
122    |                 ^^^^^^^^^^^^^^^^^^ help: use: `x_ref.as_ref()`
123
124 error: unnecessary use of `to_vec`
125   --> $DIR/unnecessary_to_owned.rs:75:19
126    |
127 LL |     require_slice(&slice.to_vec());
128    |                   ^^^^^^^^^^^^^^^ help: use: `slice`
129
130 error: unnecessary use of `into_owned`
131   --> $DIR/unnecessary_to_owned.rs:76:36
132    |
133 LL |     require_slice(&Cow::from(slice).into_owned());
134    |                                    ^^^^^^^^^^^^^ help: remove this
135
136 error: unnecessary use of `to_owned`
137   --> $DIR/unnecessary_to_owned.rs:77:19
138    |
139 LL |     require_slice(&array.to_owned());
140    |                   ^^^^^^^^^^^^^^^^^ help: use: `array.as_ref()`
141
142 error: unnecessary use of `to_owned`
143   --> $DIR/unnecessary_to_owned.rs:78:19
144    |
145 LL |     require_slice(&array_ref.to_owned());
146    |                   ^^^^^^^^^^^^^^^^^^^^^ help: use: `array_ref.as_ref()`
147
148 error: unnecessary use of `to_owned`
149   --> $DIR/unnecessary_to_owned.rs:79:19
150    |
151 LL |     require_slice(&slice.to_owned());
152    |                   ^^^^^^^^^^^^^^^^^ help: use: `slice`
153
154 error: unnecessary use of `to_owned`
155   --> $DIR/unnecessary_to_owned.rs:80:19
156    |
157 LL |     require_slice(&x_ref.to_owned());
158    |                   ^^^^^^^^^^^^^^^^^ help: use: `x_ref`
159
160 error: unnecessary use of `into_owned`
161   --> $DIR/unnecessary_to_owned.rs:82:42
162    |
163 LL |     require_x(&Cow::<X>::Owned(x.clone()).into_owned());
164    |                                          ^^^^^^^^^^^^^ help: remove this
165
166 error: unnecessary use of `to_owned`
167   --> $DIR/unnecessary_to_owned.rs:83:15
168    |
169 LL |     require_x(&x_ref.to_owned());
170    |               ^^^^^^^^^^^^^^^^^ help: use: `x_ref`
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:196: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_string`
495   --> $DIR/unnecessary_to_owned.rs:260:24
496    |
497 LL |         Box::new(build(y.to_string()))
498    |                        ^^^^^^^^^^^^^ help: use: `y`
499
500 error: aborting due to 77 previous errors
501