2 --> $DIR/unnecessary_to_owned.rs:151:64
4 LL | require_c_str(&CString::from_vec_with_nul(vec![0]).unwrap().to_owned());
5 | ^^^^^^^^^^^ help: remove this
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:151:20
11 LL | require_c_str(&CString::from_vec_with_nul(vec![0]).unwrap().to_owned());
12 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14 error: redundant clone
15 --> $DIR/unnecessary_to_owned.rs:152:40
17 LL | require_os_str(&OsString::from("x").to_os_string());
18 | ^^^^^^^^^^^^^^^ help: remove this
20 note: this value is dropped without further use
21 --> $DIR/unnecessary_to_owned.rs:152:21
23 LL | require_os_str(&OsString::from("x").to_os_string());
26 error: redundant clone
27 --> $DIR/unnecessary_to_owned.rs:153:48
29 LL | require_path(&std::path::PathBuf::from("x").to_path_buf());
30 | ^^^^^^^^^^^^^^ help: remove this
32 note: this value is dropped without further use
33 --> $DIR/unnecessary_to_owned.rs:153:19
35 LL | require_path(&std::path::PathBuf::from("x").to_path_buf());
36 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
38 error: redundant clone
39 --> $DIR/unnecessary_to_owned.rs:154:35
41 LL | require_str(&String::from("x").to_string());
42 | ^^^^^^^^^^^^ help: remove this
44 note: this value is dropped without further use
45 --> $DIR/unnecessary_to_owned.rs:154:18
47 LL | require_str(&String::from("x").to_string());
50 error: unnecessary use of `into_owned`
51 --> $DIR/unnecessary_to_owned.rs:60:36
53 LL | require_c_str(&Cow::from(c_str).into_owned());
54 | ^^^^^^^^^^^^^ help: remove this
56 = note: `-D clippy::unnecessary-to-owned` implied by `-D warnings`
58 error: unnecessary use of `to_owned`
59 --> $DIR/unnecessary_to_owned.rs:61:19
61 LL | require_c_str(&c_str.to_owned());
62 | ^^^^^^^^^^^^^^^^^ help: use: `c_str`
64 error: unnecessary use of `to_os_string`
65 --> $DIR/unnecessary_to_owned.rs:63:20
67 LL | require_os_str(&os_str.to_os_string());
68 | ^^^^^^^^^^^^^^^^^^^^^^ help: use: `os_str`
70 error: unnecessary use of `into_owned`
71 --> $DIR/unnecessary_to_owned.rs:64:38
73 LL | require_os_str(&Cow::from(os_str).into_owned());
74 | ^^^^^^^^^^^^^ help: remove this
76 error: unnecessary use of `to_owned`
77 --> $DIR/unnecessary_to_owned.rs:65:20
79 LL | require_os_str(&os_str.to_owned());
80 | ^^^^^^^^^^^^^^^^^^ help: use: `os_str`
82 error: unnecessary use of `to_path_buf`
83 --> $DIR/unnecessary_to_owned.rs:67:18
85 LL | require_path(&path.to_path_buf());
86 | ^^^^^^^^^^^^^^^^^^^ help: use: `path`
88 error: unnecessary use of `into_owned`
89 --> $DIR/unnecessary_to_owned.rs:68:34
91 LL | require_path(&Cow::from(path).into_owned());
92 | ^^^^^^^^^^^^^ help: remove this
94 error: unnecessary use of `to_owned`
95 --> $DIR/unnecessary_to_owned.rs:69:18
97 LL | require_path(&path.to_owned());
98 | ^^^^^^^^^^^^^^^^ help: use: `path`
100 error: unnecessary use of `to_string`
101 --> $DIR/unnecessary_to_owned.rs:71:17
103 LL | require_str(&s.to_string());
104 | ^^^^^^^^^^^^^^ help: use: `s`
106 error: unnecessary use of `into_owned`
107 --> $DIR/unnecessary_to_owned.rs:72:30
109 LL | require_str(&Cow::from(s).into_owned());
110 | ^^^^^^^^^^^^^ help: remove this
112 error: unnecessary use of `to_owned`
113 --> $DIR/unnecessary_to_owned.rs:73:17
115 LL | require_str(&s.to_owned());
116 | ^^^^^^^^^^^^^ help: use: `s`
118 error: unnecessary use of `to_string`
119 --> $DIR/unnecessary_to_owned.rs:74:17
121 LL | require_str(&x_ref.to_string());
122 | ^^^^^^^^^^^^^^^^^^ help: use: `x_ref.as_ref()`
124 error: unnecessary use of `to_vec`
125 --> $DIR/unnecessary_to_owned.rs:76:19
127 LL | require_slice(&slice.to_vec());
128 | ^^^^^^^^^^^^^^^ help: use: `slice`
130 error: unnecessary use of `into_owned`
131 --> $DIR/unnecessary_to_owned.rs:77:36
133 LL | require_slice(&Cow::from(slice).into_owned());
134 | ^^^^^^^^^^^^^ help: remove this
136 error: unnecessary use of `to_owned`
137 --> $DIR/unnecessary_to_owned.rs:78:19
139 LL | require_slice(&array.to_owned());
140 | ^^^^^^^^^^^^^^^^^ help: use: `array.as_ref()`
142 error: unnecessary use of `to_owned`
143 --> $DIR/unnecessary_to_owned.rs:79:19
145 LL | require_slice(&array_ref.to_owned());
146 | ^^^^^^^^^^^^^^^^^^^^^ help: use: `array_ref.as_ref()`
148 error: unnecessary use of `to_owned`
149 --> $DIR/unnecessary_to_owned.rs:80:19
151 LL | require_slice(&slice.to_owned());
152 | ^^^^^^^^^^^^^^^^^ help: use: `slice`
154 error: unnecessary use of `to_owned`
155 --> $DIR/unnecessary_to_owned.rs:81:19
157 LL | require_slice(&x_ref.to_owned());
158 | ^^^^^^^^^^^^^^^^^ help: use: `x_ref`
160 error: unnecessary use of `into_owned`
161 --> $DIR/unnecessary_to_owned.rs:83:42
163 LL | require_x(&Cow::<X>::Owned(x.clone()).into_owned());
164 | ^^^^^^^^^^^^^ help: remove this
166 error: unnecessary use of `to_owned`
167 --> $DIR/unnecessary_to_owned.rs:84:15
169 LL | require_x(&x_ref.to_owned());
170 | ^^^^^^^^^^^^^^^^^ help: use: `x_ref`
172 error: unnecessary use of `to_owned`
173 --> $DIR/unnecessary_to_owned.rs:86:25
175 LL | require_deref_c_str(c_str.to_owned());
176 | ^^^^^^^^^^^^^^^^ help: use: `c_str`
178 error: unnecessary use of `to_owned`
179 --> $DIR/unnecessary_to_owned.rs:87:26
181 LL | require_deref_os_str(os_str.to_owned());
182 | ^^^^^^^^^^^^^^^^^ help: use: `os_str`
184 error: unnecessary use of `to_owned`
185 --> $DIR/unnecessary_to_owned.rs:88:24
187 LL | require_deref_path(path.to_owned());
188 | ^^^^^^^^^^^^^^^ help: use: `path`
190 error: unnecessary use of `to_owned`
191 --> $DIR/unnecessary_to_owned.rs:89:23
193 LL | require_deref_str(s.to_owned());
194 | ^^^^^^^^^^^^ help: use: `s`
196 error: unnecessary use of `to_owned`
197 --> $DIR/unnecessary_to_owned.rs:90:25
199 LL | require_deref_slice(slice.to_owned());
200 | ^^^^^^^^^^^^^^^^ help: use: `slice`
202 error: unnecessary use of `to_owned`
203 --> $DIR/unnecessary_to_owned.rs:92:30
205 LL | require_impl_deref_c_str(c_str.to_owned());
206 | ^^^^^^^^^^^^^^^^ help: use: `c_str`
208 error: unnecessary use of `to_owned`
209 --> $DIR/unnecessary_to_owned.rs:93:31
211 LL | require_impl_deref_os_str(os_str.to_owned());
212 | ^^^^^^^^^^^^^^^^^ help: use: `os_str`
214 error: unnecessary use of `to_owned`
215 --> $DIR/unnecessary_to_owned.rs:94:29
217 LL | require_impl_deref_path(path.to_owned());
218 | ^^^^^^^^^^^^^^^ help: use: `path`
220 error: unnecessary use of `to_owned`
221 --> $DIR/unnecessary_to_owned.rs:95:28
223 LL | require_impl_deref_str(s.to_owned());
224 | ^^^^^^^^^^^^ help: use: `s`
226 error: unnecessary use of `to_owned`
227 --> $DIR/unnecessary_to_owned.rs:96:30
229 LL | require_impl_deref_slice(slice.to_owned());
230 | ^^^^^^^^^^^^^^^^ help: use: `slice`
232 error: unnecessary use of `to_owned`
233 --> $DIR/unnecessary_to_owned.rs:98:29
235 LL | require_deref_str_slice(s.to_owned(), slice.to_owned());
236 | ^^^^^^^^^^^^ help: use: `s`
238 error: unnecessary use of `to_owned`
239 --> $DIR/unnecessary_to_owned.rs:98:43
241 LL | require_deref_str_slice(s.to_owned(), slice.to_owned());
242 | ^^^^^^^^^^^^^^^^ help: use: `slice`
244 error: unnecessary use of `to_owned`
245 --> $DIR/unnecessary_to_owned.rs:99:29
247 LL | require_deref_slice_str(slice.to_owned(), s.to_owned());
248 | ^^^^^^^^^^^^^^^^ help: use: `slice`
250 error: unnecessary use of `to_owned`
251 --> $DIR/unnecessary_to_owned.rs:99:47
253 LL | require_deref_slice_str(slice.to_owned(), s.to_owned());
254 | ^^^^^^^^^^^^ help: use: `s`
256 error: unnecessary use of `to_owned`
257 --> $DIR/unnecessary_to_owned.rs:101:26
259 LL | require_as_ref_c_str(c_str.to_owned());
260 | ^^^^^^^^^^^^^^^^ help: use: `c_str`
262 error: unnecessary use of `to_owned`
263 --> $DIR/unnecessary_to_owned.rs:102:27
265 LL | require_as_ref_os_str(os_str.to_owned());
266 | ^^^^^^^^^^^^^^^^^ help: use: `os_str`
268 error: unnecessary use of `to_owned`
269 --> $DIR/unnecessary_to_owned.rs:103:25
271 LL | require_as_ref_path(path.to_owned());
272 | ^^^^^^^^^^^^^^^ help: use: `path`
274 error: unnecessary use of `to_owned`
275 --> $DIR/unnecessary_to_owned.rs:104:24
277 LL | require_as_ref_str(s.to_owned());
278 | ^^^^^^^^^^^^ help: use: `s`
280 error: unnecessary use of `to_owned`
281 --> $DIR/unnecessary_to_owned.rs:105:24
283 LL | require_as_ref_str(x.to_owned());
284 | ^^^^^^^^^^^^ help: use: `&x`
286 error: unnecessary use of `to_owned`
287 --> $DIR/unnecessary_to_owned.rs:106:26
289 LL | require_as_ref_slice(array.to_owned());
290 | ^^^^^^^^^^^^^^^^ help: use: `array`
292 error: unnecessary use of `to_owned`
293 --> $DIR/unnecessary_to_owned.rs:107:26
295 LL | require_as_ref_slice(array_ref.to_owned());
296 | ^^^^^^^^^^^^^^^^^^^^ help: use: `array_ref`
298 error: unnecessary use of `to_owned`
299 --> $DIR/unnecessary_to_owned.rs:108:26
301 LL | require_as_ref_slice(slice.to_owned());
302 | ^^^^^^^^^^^^^^^^ help: use: `slice`
304 error: unnecessary use of `to_owned`
305 --> $DIR/unnecessary_to_owned.rs:110:31
307 LL | require_impl_as_ref_c_str(c_str.to_owned());
308 | ^^^^^^^^^^^^^^^^ help: use: `c_str`
310 error: unnecessary use of `to_owned`
311 --> $DIR/unnecessary_to_owned.rs:111:32
313 LL | require_impl_as_ref_os_str(os_str.to_owned());
314 | ^^^^^^^^^^^^^^^^^ help: use: `os_str`
316 error: unnecessary use of `to_owned`
317 --> $DIR/unnecessary_to_owned.rs:112:30
319 LL | require_impl_as_ref_path(path.to_owned());
320 | ^^^^^^^^^^^^^^^ help: use: `path`
322 error: unnecessary use of `to_owned`
323 --> $DIR/unnecessary_to_owned.rs:113:29
325 LL | require_impl_as_ref_str(s.to_owned());
326 | ^^^^^^^^^^^^ help: use: `s`
328 error: unnecessary use of `to_owned`
329 --> $DIR/unnecessary_to_owned.rs:114:29
331 LL | require_impl_as_ref_str(x.to_owned());
332 | ^^^^^^^^^^^^ help: use: `&x`
334 error: unnecessary use of `to_owned`
335 --> $DIR/unnecessary_to_owned.rs:115:31
337 LL | require_impl_as_ref_slice(array.to_owned());
338 | ^^^^^^^^^^^^^^^^ help: use: `array`
340 error: unnecessary use of `to_owned`
341 --> $DIR/unnecessary_to_owned.rs:116:31
343 LL | require_impl_as_ref_slice(array_ref.to_owned());
344 | ^^^^^^^^^^^^^^^^^^^^ help: use: `array_ref`
346 error: unnecessary use of `to_owned`
347 --> $DIR/unnecessary_to_owned.rs:117:31
349 LL | require_impl_as_ref_slice(slice.to_owned());
350 | ^^^^^^^^^^^^^^^^ help: use: `slice`
352 error: unnecessary use of `to_owned`
353 --> $DIR/unnecessary_to_owned.rs:119:30
355 LL | require_as_ref_str_slice(s.to_owned(), array.to_owned());
356 | ^^^^^^^^^^^^ help: use: `s`
358 error: unnecessary use of `to_owned`
359 --> $DIR/unnecessary_to_owned.rs:119:44
361 LL | require_as_ref_str_slice(s.to_owned(), array.to_owned());
362 | ^^^^^^^^^^^^^^^^ help: use: `array`
364 error: unnecessary use of `to_owned`
365 --> $DIR/unnecessary_to_owned.rs:120:30
367 LL | require_as_ref_str_slice(s.to_owned(), array_ref.to_owned());
368 | ^^^^^^^^^^^^ help: use: `s`
370 error: unnecessary use of `to_owned`
371 --> $DIR/unnecessary_to_owned.rs:120:44
373 LL | require_as_ref_str_slice(s.to_owned(), array_ref.to_owned());
374 | ^^^^^^^^^^^^^^^^^^^^ help: use: `array_ref`
376 error: unnecessary use of `to_owned`
377 --> $DIR/unnecessary_to_owned.rs:121:30
379 LL | require_as_ref_str_slice(s.to_owned(), slice.to_owned());
380 | ^^^^^^^^^^^^ help: use: `s`
382 error: unnecessary use of `to_owned`
383 --> $DIR/unnecessary_to_owned.rs:121:44
385 LL | require_as_ref_str_slice(s.to_owned(), slice.to_owned());
386 | ^^^^^^^^^^^^^^^^ help: use: `slice`
388 error: unnecessary use of `to_owned`
389 --> $DIR/unnecessary_to_owned.rs:122:30
391 LL | require_as_ref_slice_str(array.to_owned(), s.to_owned());
392 | ^^^^^^^^^^^^^^^^ help: use: `array`
394 error: unnecessary use of `to_owned`
395 --> $DIR/unnecessary_to_owned.rs:122:48
397 LL | require_as_ref_slice_str(array.to_owned(), s.to_owned());
398 | ^^^^^^^^^^^^ help: use: `s`
400 error: unnecessary use of `to_owned`
401 --> $DIR/unnecessary_to_owned.rs:123:30
403 LL | require_as_ref_slice_str(array_ref.to_owned(), s.to_owned());
404 | ^^^^^^^^^^^^^^^^^^^^ help: use: `array_ref`
406 error: unnecessary use of `to_owned`
407 --> $DIR/unnecessary_to_owned.rs:123:52
409 LL | require_as_ref_slice_str(array_ref.to_owned(), s.to_owned());
410 | ^^^^^^^^^^^^ help: use: `s`
412 error: unnecessary use of `to_owned`
413 --> $DIR/unnecessary_to_owned.rs:124:30
415 LL | require_as_ref_slice_str(slice.to_owned(), s.to_owned());
416 | ^^^^^^^^^^^^^^^^ help: use: `slice`
418 error: unnecessary use of `to_owned`
419 --> $DIR/unnecessary_to_owned.rs:124:48
421 LL | require_as_ref_slice_str(slice.to_owned(), s.to_owned());
422 | ^^^^^^^^^^^^ help: use: `s`
424 error: unnecessary use of `to_string`
425 --> $DIR/unnecessary_to_owned.rs:126:20
427 LL | let _ = x.join(&x_ref.to_string());
428 | ^^^^^^^^^^^^^^^^^^ help: use: `x_ref`
430 error: unnecessary use of `to_vec`
431 --> $DIR/unnecessary_to_owned.rs:128:13
433 LL | let _ = slice.to_vec().into_iter();
434 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `slice.iter().copied()`
436 error: unnecessary use of `to_owned`
437 --> $DIR/unnecessary_to_owned.rs:129:13
439 LL | let _ = slice.to_owned().into_iter();
440 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `slice.iter().copied()`
442 error: unnecessary use of `to_vec`
443 --> $DIR/unnecessary_to_owned.rs:130:13
445 LL | let _ = [std::path::PathBuf::new()][..].to_vec().into_iter();
446 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `[std::path::PathBuf::new()][..].iter().cloned()`
448 error: unnecessary use of `to_owned`
449 --> $DIR/unnecessary_to_owned.rs:131:13
451 LL | let _ = [std::path::PathBuf::new()][..].to_owned().into_iter();
452 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `[std::path::PathBuf::new()][..].iter().cloned()`
454 error: unnecessary use of `to_vec`
455 --> $DIR/unnecessary_to_owned.rs:133:13
457 LL | let _ = IntoIterator::into_iter(slice.to_vec());
458 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `slice.iter().copied()`
460 error: unnecessary use of `to_owned`
461 --> $DIR/unnecessary_to_owned.rs:134:13
463 LL | let _ = IntoIterator::into_iter(slice.to_owned());
464 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `slice.iter().copied()`
466 error: unnecessary use of `to_vec`
467 --> $DIR/unnecessary_to_owned.rs:135:13
469 LL | let _ = IntoIterator::into_iter([std::path::PathBuf::new()][..].to_vec());
470 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `[std::path::PathBuf::new()][..].iter().cloned()`
472 error: unnecessary use of `to_owned`
473 --> $DIR/unnecessary_to_owned.rs:136:13
475 LL | let _ = IntoIterator::into_iter([std::path::PathBuf::new()][..].to_owned());
476 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `[std::path::PathBuf::new()][..].iter().cloned()`
478 error: unnecessary use of `to_vec`
479 --> $DIR/unnecessary_to_owned.rs:197:14
481 LL | for t in file_types.to_vec() {
482 | ^^^^^^^^^^^^^^^^^^^
486 LL | for t in file_types {
488 help: remove this `&`
490 LL - let path = match get_file_path(&t) {
491 LL + let path = match get_file_path(t) {
494 error: unnecessary use of `to_vec`
495 --> $DIR/unnecessary_to_owned.rs:220:14
497 LL | let _ = &["x"][..].to_vec().into_iter();
498 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `["x"][..].iter().cloned()`
500 error: unnecessary use of `to_vec`
501 --> $DIR/unnecessary_to_owned.rs:225:14
503 LL | let _ = &["x"][..].to_vec().into_iter();
504 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `["x"][..].iter().copied()`
506 error: unnecessary use of `to_string`
507 --> $DIR/unnecessary_to_owned.rs:272:24
509 LL | Box::new(build(y.to_string()))
510 | ^^^^^^^^^^^^^ help: use: `y`
512 error: aborting due to 79 previous errors