]> git.proxmox.com Git - rustc.git/blame - src/tools/clippy/tests/ui/string_extend.rs
Update upstream source from tag 'upstream/1.52.1+dfsg1'
[rustc.git] / src / tools / clippy / tests / ui / string_extend.rs
CommitLineData
f20569fa
XL
1// run-rustfix
2
3#[derive(Copy, Clone)]
4struct HasChars;
5
6impl HasChars {
7 fn chars(self) -> std::str::Chars<'static> {
8 "HasChars".chars()
9 }
10}
11
12fn 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}