]> git.lizzy.rs Git - rust.git/blob - tests/ui/use_self.rs
Merge pull request #1965 from montrivo/use_self
[rust.git] / tests / ui / use_self.rs
1 #![feature(plugin)]
2 #![plugin(clippy)]
3 #![warn(use_self)]
4 #![allow(dead_code)]
5
6
7 fn main() {}
8
9 mod use_self {
10     struct Foo {}
11
12     impl Foo {
13         fn new() -> Foo {
14             Foo {}
15         }
16         fn test() -> Foo {
17             Foo::new()
18         }
19     }
20
21     impl Default for Foo {
22         fn default() -> Foo {
23             Foo::new()
24         }
25     }
26 }
27
28 mod better {
29     struct Foo {}
30
31     impl Foo {
32         fn new() -> Self {
33             Self {}
34         }
35         fn test() -> Self {
36             Self::new()
37         }
38     }
39
40     impl Default for Foo {
41         fn default() -> Self {
42             Self::new()
43         }
44     }
45 }