]> git.proxmox.com Git - rustc.git/blob - src/tools/clippy/tests/ui/string_extend.fixed
d200d7310fca5b5da74013bdae02e0c5aea07a17
[rustc.git] / src / tools / clippy / tests / ui / string_extend.fixed
1 // run-rustfix
2
3 #[derive(Copy, Clone)]
4 struct HasChars;
5
6 impl HasChars {
7 fn chars(self) -> std::str::Chars<'static> {
8 "HasChars".chars()
9 }
10 }
11
12 fn main() {
13 let abc = "abc";
14 let def = String::from("def");
15 let mut s = String::new();
16
17 s.push_str(abc);
18 s.push_str(abc);
19
20 s.push_str("abc");
21 s.push_str("abc");
22
23 s.push_str(&def);
24 s.push_str(&def);
25
26 s.extend(abc.chars().skip(1));
27 s.extend("abc".chars().skip(1));
28 s.extend(['a', 'b', 'c'].iter());
29
30 let f = HasChars;
31 s.extend(f.chars());
32
33 // issue #9735
34 s.push_str(&abc[0..2]);
35 }