blob: f43d92a2d9babc359f270a814c14d87206ba6ee4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#![allow(clippy::single_char_pattern)]
struct Issue12068;
impl AsRef<str> for Issue12068 {
fn as_ref(&self) -> &str {
""
}
}
#[allow(clippy::to_string_trait_impl)]
impl ToString for Issue12068 {
fn to_string(&self) -> String {
String::new()
}
}
fn main() {
let _ = "a".split('a').next().unwrap();
//~^ unnecessary_to_owned
let _ = "a".split("a").next().unwrap();
//~^ unnecessary_to_owned
let _ = "a".split('a').next().unwrap();
//~^ unnecessary_to_owned
let _ = "a".split("a").next().unwrap();
//~^ unnecessary_to_owned
let _ = Issue12068.as_ref().split('a').next().unwrap();
//~^ unnecessary_to_owned
let _ = [1].split(|x| *x == 2).next().unwrap();
//~^ unnecessary_to_owned
let _ = [1].split(|x| *x == 2).next().unwrap();
//~^ unnecessary_to_owned
let _ = [1].split(|x| *x == 2).next().unwrap();
//~^ unnecessary_to_owned
let _ = [1].split(|x| *x == 2).next().unwrap();
//~^ unnecessary_to_owned
}
|