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