mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-12 08:36:03 +00:00
38 lines
1.1 KiB
Rust
38 lines
1.1 KiB
Rust
#![allow(clippy::single_char_pattern)]
|
|
|
|
struct Issue12068;
|
|
|
|
impl AsRef<str> for Issue12068 {
|
|
fn as_ref(&self) -> &str {
|
|
""
|
|
}
|
|
}
|
|
|
|
impl ToString for Issue12068 {
|
|
fn to_string(&self) -> String {
|
|
String::new()
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
let _ = "a".split('a').next().unwrap();
|
|
//~^ ERROR: unnecessary use of `to_string`
|
|
let _ = "a".split("a").next().unwrap();
|
|
//~^ ERROR: unnecessary use of `to_string`
|
|
let _ = "a".split('a').next().unwrap();
|
|
//~^ ERROR: unnecessary use of `to_owned`
|
|
let _ = "a".split("a").next().unwrap();
|
|
//~^ ERROR: unnecessary use of `to_owned`
|
|
let _ = Issue12068.as_ref().split('a').next().unwrap();
|
|
//~^ ERROR: unnecessary use of `to_string`
|
|
|
|
let _ = [1].split(|x| *x == 2).next().unwrap();
|
|
//~^ ERROR: unnecessary use of `to_vec`
|
|
let _ = [1].split(|x| *x == 2).next().unwrap();
|
|
//~^ ERROR: unnecessary use of `to_vec`
|
|
let _ = [1].split(|x| *x == 2).next().unwrap();
|
|
//~^ ERROR: unnecessary use of `to_owned`
|
|
let _ = [1].split(|x| *x == 2).next().unwrap();
|
|
//~^ ERROR: unnecessary use of `to_owned`
|
|
}
|