]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/string_extend.rs
Rollup merge of #102092 - kxxt:patch-1, r=joshtriplett
[rust.git] / src / tools / clippy / tests / ui / string_extend.rs
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.extend(abc.chars());
19
20     s.push_str("abc");
21     s.extend("abc".chars());
22
23     s.push_str(&def);
24     s.extend(def.chars());
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 }