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