]>
Commit | Line | Data |
---|---|---|
f20569fa XL |
1 | // run-rustfix |
2 | ||
3 | #![allow(unused_must_use)] | |
4 | ||
5 | use std::collections::HashSet; | |
6 | ||
7 | fn main() { | |
8 | let x = "foo"; | |
9 | x.split("x"); | |
10 | x.split("xx"); | |
11 | x.split('x'); | |
12 | ||
13 | let y = "x"; | |
14 | x.split(y); | |
15 | x.split("ß"); | |
16 | x.split("ℝ"); | |
17 | x.split("💣"); | |
18 | // Can't use this lint for unicode code points which don't fit in a char | |
19 | x.split("❤️"); | |
20 | x.contains("x"); | |
21 | x.starts_with("x"); | |
22 | x.ends_with("x"); | |
23 | x.find("x"); | |
24 | x.rfind("x"); | |
25 | x.rsplit("x"); | |
26 | x.split_terminator("x"); | |
27 | x.rsplit_terminator("x"); | |
17df50a5 XL |
28 | x.splitn(2, "x"); |
29 | x.rsplitn(2, "x"); | |
f20569fa XL |
30 | x.matches("x"); |
31 | x.rmatches("x"); | |
32 | x.match_indices("x"); | |
33 | x.rmatch_indices("x"); | |
34 | x.trim_start_matches("x"); | |
35 | x.trim_end_matches("x"); | |
17df50a5 XL |
36 | x.strip_prefix("x"); |
37 | x.strip_suffix("x"); | |
f20569fa XL |
38 | // Make sure we escape characters correctly. |
39 | x.split("\n"); | |
40 | x.split("'"); | |
41 | x.split("\'"); | |
42 | ||
43 | let h = HashSet::<String>::new(); | |
44 | h.contains("X"); // should not warn | |
45 | ||
46 | x.replace(";", ",").split(","); // issue #2978 | |
47 | x.starts_with("\x03"); // issue #2996 | |
48 | ||
49 | // Issue #3204 | |
50 | const S: &str = "#"; | |
51 | x.find(S); | |
52 | ||
53 | // Raw string | |
54 | x.split(r"a"); | |
55 | x.split(r#"a"#); | |
56 | x.split(r###"a"###); | |
57 | x.split(r###"'"###); | |
58 | x.split(r###"#"###); | |
59 | } |