]> git.lizzy.rs Git - rust.git/blob - tests/ui/string_extend.rs
Merge pull request #2126 from camsteffen/split-tests
[rust.git] / tests / ui / string_extend.rs
1 #[derive(Copy, Clone)]
2 struct HasChars;
3
4 impl HasChars {
5     fn chars(self) -> std::str::Chars<'static> {
6         "HasChars".chars()
7     }
8 }
9
10 fn main() {
11     let abc = "abc";
12     let def = String::from("def");
13     let mut s = String::new();
14
15     s.push_str(abc);
16     s.extend(abc.chars());
17
18     s.push_str("abc");
19     s.extend("abc".chars());
20
21     s.push_str(&def);
22     s.extend(def.chars());
23
24     s.extend(abc.chars().skip(1));
25     s.extend("abc".chars().skip(1));
26     s.extend(['a', 'b', 'c'].iter());
27
28     let f = HasChars;
29     s.extend(f.chars());
30 }