mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-16 02:24:35 +00:00
290f74be4e
* Share a list of methods with `implicit_clone` * Ensure no overlap with `redundant_clone`
432 lines
15 KiB
Plaintext
432 lines
15 KiB
Plaintext
error: redundant clone
|
|
--> $DIR/unnecessary_to_owned.rs:134:64
|
|
|
|
|
LL | require_c_str(&CString::from_vec_with_nul(vec![0]).unwrap().to_owned());
|
|
| ^^^^^^^^^^^ help: remove this
|
|
|
|
|
= note: `-D clippy::redundant-clone` implied by `-D warnings`
|
|
note: this value is dropped without further use
|
|
--> $DIR/unnecessary_to_owned.rs:134:20
|
|
|
|
|
LL | require_c_str(&CString::from_vec_with_nul(vec![0]).unwrap().to_owned());
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: redundant clone
|
|
--> $DIR/unnecessary_to_owned.rs:135:40
|
|
|
|
|
LL | require_os_str(&OsString::from("x").to_os_string());
|
|
| ^^^^^^^^^^^^^^^ help: remove this
|
|
|
|
|
note: this value is dropped without further use
|
|
--> $DIR/unnecessary_to_owned.rs:135:21
|
|
|
|
|
LL | require_os_str(&OsString::from("x").to_os_string());
|
|
| ^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: redundant clone
|
|
--> $DIR/unnecessary_to_owned.rs:136:48
|
|
|
|
|
LL | require_path(&std::path::PathBuf::from("x").to_path_buf());
|
|
| ^^^^^^^^^^^^^^ help: remove this
|
|
|
|
|
note: this value is dropped without further use
|
|
--> $DIR/unnecessary_to_owned.rs:136:19
|
|
|
|
|
LL | require_path(&std::path::PathBuf::from("x").to_path_buf());
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: redundant clone
|
|
--> $DIR/unnecessary_to_owned.rs:137:35
|
|
|
|
|
LL | require_str(&String::from("x").to_string());
|
|
| ^^^^^^^^^^^^ help: remove this
|
|
|
|
|
note: this value is dropped without further use
|
|
--> $DIR/unnecessary_to_owned.rs:137:18
|
|
|
|
|
LL | require_str(&String::from("x").to_string());
|
|
| ^^^^^^^^^^^^^^^^^
|
|
|
|
error: unnecessary use of `into_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:55:36
|
|
|
|
|
LL | require_c_str(&Cow::from(c_str).into_owned());
|
|
| ^^^^^^^^^^^^^ help: remove this
|
|
|
|
|
= note: `-D clippy::unnecessary-to-owned` implied by `-D warnings`
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:56:19
|
|
|
|
|
LL | require_c_str(&c_str.to_owned());
|
|
| ^^^^^^^^^^^^^^^^^ help: use: `c_str`
|
|
|
|
error: unnecessary use of `to_os_string`
|
|
--> $DIR/unnecessary_to_owned.rs:58:20
|
|
|
|
|
LL | require_os_str(&os_str.to_os_string());
|
|
| ^^^^^^^^^^^^^^^^^^^^^^ help: use: `os_str`
|
|
|
|
error: unnecessary use of `into_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:59:38
|
|
|
|
|
LL | require_os_str(&Cow::from(os_str).into_owned());
|
|
| ^^^^^^^^^^^^^ help: remove this
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:60:20
|
|
|
|
|
LL | require_os_str(&os_str.to_owned());
|
|
| ^^^^^^^^^^^^^^^^^^ help: use: `os_str`
|
|
|
|
error: unnecessary use of `to_path_buf`
|
|
--> $DIR/unnecessary_to_owned.rs:62:18
|
|
|
|
|
LL | require_path(&path.to_path_buf());
|
|
| ^^^^^^^^^^^^^^^^^^^ help: use: `path`
|
|
|
|
error: unnecessary use of `into_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:63:34
|
|
|
|
|
LL | require_path(&Cow::from(path).into_owned());
|
|
| ^^^^^^^^^^^^^ help: remove this
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:64:18
|
|
|
|
|
LL | require_path(&path.to_owned());
|
|
| ^^^^^^^^^^^^^^^^ help: use: `path`
|
|
|
|
error: unnecessary use of `to_string`
|
|
--> $DIR/unnecessary_to_owned.rs:66:17
|
|
|
|
|
LL | require_str(&s.to_string());
|
|
| ^^^^^^^^^^^^^^ help: use: `s`
|
|
|
|
error: unnecessary use of `into_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:67:30
|
|
|
|
|
LL | require_str(&Cow::from(s).into_owned());
|
|
| ^^^^^^^^^^^^^ help: remove this
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:68:17
|
|
|
|
|
LL | require_str(&s.to_owned());
|
|
| ^^^^^^^^^^^^^ help: use: `s`
|
|
|
|
error: unnecessary use of `to_string`
|
|
--> $DIR/unnecessary_to_owned.rs:69:17
|
|
|
|
|
LL | require_str(&x_ref.to_string());
|
|
| ^^^^^^^^^^^^^^^^^^ help: use: `x_ref.as_ref()`
|
|
|
|
error: unnecessary use of `to_vec`
|
|
--> $DIR/unnecessary_to_owned.rs:71:19
|
|
|
|
|
LL | require_slice(&slice.to_vec());
|
|
| ^^^^^^^^^^^^^^^ help: use: `slice`
|
|
|
|
error: unnecessary use of `into_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:72:36
|
|
|
|
|
LL | require_slice(&Cow::from(slice).into_owned());
|
|
| ^^^^^^^^^^^^^ help: remove this
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:73:19
|
|
|
|
|
LL | require_slice(&array.to_owned());
|
|
| ^^^^^^^^^^^^^^^^^ help: use: `array.as_ref()`
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:74:19
|
|
|
|
|
LL | require_slice(&array_ref.to_owned());
|
|
| ^^^^^^^^^^^^^^^^^^^^^ help: use: `array_ref.as_ref()`
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:75:19
|
|
|
|
|
LL | require_slice(&slice.to_owned());
|
|
| ^^^^^^^^^^^^^^^^^ help: use: `slice`
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:76:19
|
|
|
|
|
LL | require_slice(&x_ref.to_owned());
|
|
| ^^^^^^^^^^^^^^^^^ help: use: `x_ref`
|
|
|
|
error: unnecessary use of `into_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:78:42
|
|
|
|
|
LL | require_x(&Cow::<X>::Owned(x.clone()).into_owned());
|
|
| ^^^^^^^^^^^^^ help: remove this
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:79:15
|
|
|
|
|
LL | require_x(&x_ref.to_owned());
|
|
| ^^^^^^^^^^^^^^^^^ help: use: `x_ref`
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:81:25
|
|
|
|
|
LL | require_deref_c_str(c_str.to_owned());
|
|
| ^^^^^^^^^^^^^^^^ help: use: `c_str`
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:82:26
|
|
|
|
|
LL | require_deref_os_str(os_str.to_owned());
|
|
| ^^^^^^^^^^^^^^^^^ help: use: `os_str`
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:83:24
|
|
|
|
|
LL | require_deref_path(path.to_owned());
|
|
| ^^^^^^^^^^^^^^^ help: use: `path`
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:84:23
|
|
|
|
|
LL | require_deref_str(s.to_owned());
|
|
| ^^^^^^^^^^^^ help: use: `s`
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:85:25
|
|
|
|
|
LL | require_deref_slice(slice.to_owned());
|
|
| ^^^^^^^^^^^^^^^^ help: use: `slice`
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:87:30
|
|
|
|
|
LL | require_impl_deref_c_str(c_str.to_owned());
|
|
| ^^^^^^^^^^^^^^^^ help: use: `c_str`
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:88:31
|
|
|
|
|
LL | require_impl_deref_os_str(os_str.to_owned());
|
|
| ^^^^^^^^^^^^^^^^^ help: use: `os_str`
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:89:29
|
|
|
|
|
LL | require_impl_deref_path(path.to_owned());
|
|
| ^^^^^^^^^^^^^^^ help: use: `path`
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:90:28
|
|
|
|
|
LL | require_impl_deref_str(s.to_owned());
|
|
| ^^^^^^^^^^^^ help: use: `s`
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:91:30
|
|
|
|
|
LL | require_impl_deref_slice(slice.to_owned());
|
|
| ^^^^^^^^^^^^^^^^ help: use: `slice`
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:93:29
|
|
|
|
|
LL | require_deref_str_slice(s.to_owned(), slice.to_owned());
|
|
| ^^^^^^^^^^^^ help: use: `s`
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:93:43
|
|
|
|
|
LL | require_deref_str_slice(s.to_owned(), slice.to_owned());
|
|
| ^^^^^^^^^^^^^^^^ help: use: `slice`
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:94:29
|
|
|
|
|
LL | require_deref_slice_str(slice.to_owned(), s.to_owned());
|
|
| ^^^^^^^^^^^^^^^^ help: use: `slice`
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:94:47
|
|
|
|
|
LL | require_deref_slice_str(slice.to_owned(), s.to_owned());
|
|
| ^^^^^^^^^^^^ help: use: `s`
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:96:26
|
|
|
|
|
LL | require_as_ref_c_str(c_str.to_owned());
|
|
| ^^^^^^^^^^^^^^^^ help: use: `c_str`
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:97:27
|
|
|
|
|
LL | require_as_ref_os_str(os_str.to_owned());
|
|
| ^^^^^^^^^^^^^^^^^ help: use: `os_str`
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:98:25
|
|
|
|
|
LL | require_as_ref_path(path.to_owned());
|
|
| ^^^^^^^^^^^^^^^ help: use: `path`
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:99:24
|
|
|
|
|
LL | require_as_ref_str(s.to_owned());
|
|
| ^^^^^^^^^^^^ help: use: `s`
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:100:24
|
|
|
|
|
LL | require_as_ref_str(x.to_owned());
|
|
| ^^^^^^^^^^^^ help: use: `&x`
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:101:26
|
|
|
|
|
LL | require_as_ref_slice(array.to_owned());
|
|
| ^^^^^^^^^^^^^^^^ help: use: `array`
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:102:26
|
|
|
|
|
LL | require_as_ref_slice(array_ref.to_owned());
|
|
| ^^^^^^^^^^^^^^^^^^^^ help: use: `array_ref`
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:103:26
|
|
|
|
|
LL | require_as_ref_slice(slice.to_owned());
|
|
| ^^^^^^^^^^^^^^^^ help: use: `slice`
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:105:31
|
|
|
|
|
LL | require_impl_as_ref_c_str(c_str.to_owned());
|
|
| ^^^^^^^^^^^^^^^^ help: use: `c_str`
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:106:32
|
|
|
|
|
LL | require_impl_as_ref_os_str(os_str.to_owned());
|
|
| ^^^^^^^^^^^^^^^^^ help: use: `os_str`
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:107:30
|
|
|
|
|
LL | require_impl_as_ref_path(path.to_owned());
|
|
| ^^^^^^^^^^^^^^^ help: use: `path`
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:108:29
|
|
|
|
|
LL | require_impl_as_ref_str(s.to_owned());
|
|
| ^^^^^^^^^^^^ help: use: `s`
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:109:29
|
|
|
|
|
LL | require_impl_as_ref_str(x.to_owned());
|
|
| ^^^^^^^^^^^^ help: use: `&x`
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:110:31
|
|
|
|
|
LL | require_impl_as_ref_slice(array.to_owned());
|
|
| ^^^^^^^^^^^^^^^^ help: use: `array`
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:111:31
|
|
|
|
|
LL | require_impl_as_ref_slice(array_ref.to_owned());
|
|
| ^^^^^^^^^^^^^^^^^^^^ help: use: `array_ref`
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:112:31
|
|
|
|
|
LL | require_impl_as_ref_slice(slice.to_owned());
|
|
| ^^^^^^^^^^^^^^^^ help: use: `slice`
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:114:30
|
|
|
|
|
LL | require_as_ref_str_slice(s.to_owned(), array.to_owned());
|
|
| ^^^^^^^^^^^^ help: use: `s`
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:114:44
|
|
|
|
|
LL | require_as_ref_str_slice(s.to_owned(), array.to_owned());
|
|
| ^^^^^^^^^^^^^^^^ help: use: `array`
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:115:30
|
|
|
|
|
LL | require_as_ref_str_slice(s.to_owned(), array_ref.to_owned());
|
|
| ^^^^^^^^^^^^ help: use: `s`
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:115:44
|
|
|
|
|
LL | require_as_ref_str_slice(s.to_owned(), array_ref.to_owned());
|
|
| ^^^^^^^^^^^^^^^^^^^^ help: use: `array_ref`
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:116:30
|
|
|
|
|
LL | require_as_ref_str_slice(s.to_owned(), slice.to_owned());
|
|
| ^^^^^^^^^^^^ help: use: `s`
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:116:44
|
|
|
|
|
LL | require_as_ref_str_slice(s.to_owned(), slice.to_owned());
|
|
| ^^^^^^^^^^^^^^^^ help: use: `slice`
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:117:30
|
|
|
|
|
LL | require_as_ref_slice_str(array.to_owned(), s.to_owned());
|
|
| ^^^^^^^^^^^^^^^^ help: use: `array`
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:117:48
|
|
|
|
|
LL | require_as_ref_slice_str(array.to_owned(), s.to_owned());
|
|
| ^^^^^^^^^^^^ help: use: `s`
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:118:30
|
|
|
|
|
LL | require_as_ref_slice_str(array_ref.to_owned(), s.to_owned());
|
|
| ^^^^^^^^^^^^^^^^^^^^ help: use: `array_ref`
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:118:52
|
|
|
|
|
LL | require_as_ref_slice_str(array_ref.to_owned(), s.to_owned());
|
|
| ^^^^^^^^^^^^ help: use: `s`
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:119:30
|
|
|
|
|
LL | require_as_ref_slice_str(slice.to_owned(), s.to_owned());
|
|
| ^^^^^^^^^^^^^^^^ help: use: `slice`
|
|
|
|
error: unnecessary use of `to_owned`
|
|
--> $DIR/unnecessary_to_owned.rs:119:48
|
|
|
|
|
LL | require_as_ref_slice_str(slice.to_owned(), s.to_owned());
|
|
| ^^^^^^^^^^^^ help: use: `s`
|
|
|
|
error: unnecessary use of `to_string`
|
|
--> $DIR/unnecessary_to_owned.rs:121:20
|
|
|
|
|
LL | let _ = x.join(&x_ref.to_string());
|
|
| ^^^^^^^^^^^^^^^^^^ help: use: `x_ref`
|
|
|
|
error: aborting due to 67 previous errors
|
|
|