]> git.lizzy.rs Git - rust.git/blob - tests/ui/single_char_pattern.fixed
Improved shared_code_in_if_blocks message and added test stderrs
[rust.git] / tests / ui / single_char_pattern.fixed
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');
28     x.splitn(0, 'x');
29     x.rsplitn(0, 'x');
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');
36     // Make sure we escape characters correctly.
37     x.split('\n');
38     x.split('\'');
39     x.split('\'');
40
41     let h = HashSet::<String>::new();
42     h.contains("X"); // should not warn
43
44     x.replace(";", ",").split(','); // issue #2978
45     x.starts_with('\x03'); // issue #2996
46
47     // Issue #3204
48     const S: &str = "#";
49     x.find(S);
50
51     // Raw string
52     x.split('a');
53     x.split('a');
54     x.split('a');
55     x.split('\'');
56     x.split('#');
57 }