]> git.lizzy.rs Git - rust.git/blob - tests/ui/wrong_self_convention.rs
Merge pull request #2984 from flip1995/single_char_pattern
[rust.git] / tests / ui / wrong_self_convention.rs
1
2
3
4 #![warn(wrong_self_convention)]
5 #![warn(wrong_pub_self_convention)]
6 #![allow(dead_code, trivially_copy_pass_by_ref)]
7
8 fn main() {}
9
10 #[derive(Clone, Copy)]
11 struct Foo;
12
13 impl Foo {
14
15     fn as_i32(self) {}
16     fn as_u32(&self) {}
17     fn into_i32(self) {}
18     fn is_i32(self) {}
19     fn is_u32(&self) {}
20     fn to_i32(self) {}
21     fn from_i32(self) {}
22
23     pub fn as_i64(self) {}
24     pub fn into_i64(self) {}
25     pub fn is_i64(self) {}
26     pub fn to_i64(self) {}
27     pub fn from_i64(self) {}
28     // check whether the lint can be allowed at the function level
29     #[allow(wrong_self_convention)]
30     pub fn from_cake(self) {}
31
32     fn as_x<F: AsRef<Self>>(_: F) { }
33     fn as_y<F: AsRef<Foo>>(_: F) { }
34 }
35
36 struct Bar;
37
38 impl Bar {
39
40     fn as_i32(self) {}
41     fn as_u32(&self) {}
42     fn into_i32(&self) {}
43     fn into_u32(self) {}
44     fn is_i32(self) {}
45     fn is_u32(&self) {}
46     fn to_i32(self) {}
47     fn to_u32(&self) {}
48     fn from_i32(self) {}
49
50     pub fn as_i64(self) {}
51     pub fn into_i64(&self) {}
52     pub fn is_i64(self) {}
53     pub fn to_i64(self) {}
54     pub fn from_i64(self) {}
55
56     // test for false positives
57     fn as_(self) {}
58     fn into_(&self) {}
59     fn is_(self) {}
60     fn to_(self) {}
61     fn from_(self) {}
62 }