rust-clippy/tests/ui/unnecessary_to_owned_on_split.stderr

59 lines
2.3 KiB
Text

error: unnecessary use of `to_string`
--> $DIR/unnecessary_to_owned_on_split.rs:18:13
|
LL | let _ = "a".to_string().split('a').next().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `"a".split('a')`
|
= note: `-D clippy::unnecessary-to-owned` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::unnecessary_to_owned)]`
error: unnecessary use of `to_string`
--> $DIR/unnecessary_to_owned_on_split.rs:20:13
|
LL | let _ = "a".to_string().split("a").next().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `"a".split("a")`
error: unnecessary use of `to_owned`
--> $DIR/unnecessary_to_owned_on_split.rs:22:13
|
LL | let _ = "a".to_owned().split('a').next().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `"a".split('a')`
error: unnecessary use of `to_owned`
--> $DIR/unnecessary_to_owned_on_split.rs:24:13
|
LL | let _ = "a".to_owned().split("a").next().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `"a".split("a")`
error: unnecessary use of `to_string`
--> $DIR/unnecessary_to_owned_on_split.rs:26:13
|
LL | let _ = Issue12068.to_string().split('a').next().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `Issue12068.as_ref().split('a')`
error: unnecessary use of `to_vec`
--> $DIR/unnecessary_to_owned_on_split.rs:29:13
|
LL | let _ = [1].to_vec().split(|x| *x == 2).next().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `[1].split(|x| *x == 2)`
error: unnecessary use of `to_vec`
--> $DIR/unnecessary_to_owned_on_split.rs:31:13
|
LL | let _ = [1].to_vec().split(|x| *x == 2).next().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `[1].split(|x| *x == 2)`
error: unnecessary use of `to_owned`
--> $DIR/unnecessary_to_owned_on_split.rs:33:13
|
LL | let _ = [1].to_owned().split(|x| *x == 2).next().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `[1].split(|x| *x == 2)`
error: unnecessary use of `to_owned`
--> $DIR/unnecessary_to_owned_on_split.rs:35:13
|
LL | let _ = [1].to_owned().split(|x| *x == 2).next().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `[1].split(|x| *x == 2)`
error: aborting due to 9 previous errors