]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/string_extend.fixed
Auto merge of #104673 - matthiaskrgr:rollup-85f65ov, r=matthiaskrgr
[rust.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 }