@@ -37,9 +37,136 @@ use option_helpers::IteratorFalsePositives;
37
37
pub struct T ;
38
38
39
39
impl T {
40
+ // *******************************************
41
+ // complete trait method list, should lint all
42
+ // *******************************************
40
43
pub fn add ( self , other : T ) -> T {
41
- self
44
+ unimplemented ! ( )
45
+ }
46
+
47
+ pub fn as_mut ( & mut self ) -> & mut T {
48
+ unimplemented ! ( )
49
+ }
50
+
51
+ pub fn as_ref ( & self ) -> & T {
52
+ unimplemented ! ( )
53
+ }
54
+
55
+ pub fn bitand ( self , rhs : T ) -> T {
56
+ unimplemented ! ( )
57
+ }
58
+
59
+ pub fn bitor ( self , rhs : Self ) -> Self {
60
+ unimplemented ! ( )
61
+ }
62
+
63
+ pub fn bitxor ( self , rhs : Self ) -> Self {
64
+ unimplemented ! ( )
65
+ }
66
+
67
+ pub fn borrow ( & self ) -> & str {
68
+ unimplemented ! ( )
69
+ }
70
+
71
+ pub fn borrow_mut ( & mut self ) -> & mut str {
72
+ unimplemented ! ( )
73
+ }
74
+
75
+ pub fn clone ( & self ) -> Self {
76
+ unimplemented ! ( )
77
+ }
78
+
79
+ pub fn cmp ( & self , other : & Self ) -> Self {
80
+ unimplemented ! ( )
81
+ }
82
+
83
+ pub fn default ( ) -> Self {
84
+ unimplemented ! ( )
85
+ }
86
+
87
+ pub fn deref ( & self ) -> & Self {
88
+ unimplemented ! ( )
89
+ }
90
+
91
+ pub fn deref_mut ( & mut self ) -> & mut Self {
92
+ unimplemented ! ( )
93
+ }
94
+
95
+ pub fn div ( self , rhs : Self ) -> Self {
96
+ unimplemented ! ( )
97
+ }
98
+
99
+ pub fn drop ( & mut self ) {
100
+ unimplemented ! ( )
101
+ }
102
+
103
+ pub fn eq ( & self , other : & Self ) -> bool {
104
+ unimplemented ! ( )
105
+ }
106
+
107
+ pub fn from_iter < T > ( iter : T ) -> Self {
108
+ unimplemented ! ( )
109
+ }
110
+
111
+ pub fn from_str ( s : & str ) -> Result < Self , Self > {
112
+ unimplemented ! ( )
113
+ }
114
+
115
+ pub fn hash ( & self , state : & mut T ) {
116
+ unimplemented ! ( )
117
+ }
118
+
119
+ pub fn index ( & self , index : usize ) -> & Self {
120
+ unimplemented ! ( )
121
+ }
122
+
123
+ pub fn index_mut ( & mut self , index : usize ) -> & mut Self {
124
+ unimplemented ! ( )
125
+ }
126
+
127
+ pub fn into_iter ( self ) -> Self {
128
+ unimplemented ! ( )
129
+ }
130
+
131
+ pub fn mul ( self , rhs : Self ) -> Self {
132
+ unimplemented ! ( )
133
+ }
134
+
135
+ pub fn neg ( self ) -> Self {
136
+ unimplemented ! ( )
137
+ }
138
+
139
+ pub fn next ( & mut self ) -> Option < Self > {
140
+ unimplemented ! ( )
141
+ }
142
+
143
+ pub fn not ( self ) -> Self {
144
+ unimplemented ! ( )
145
+ }
146
+
147
+ pub fn rem ( self , rhs : Self ) -> Self {
148
+ unimplemented ! ( )
149
+ }
150
+
151
+ pub fn shl ( self , rhs : Self ) -> Self {
152
+ unimplemented ! ( )
153
+ }
154
+
155
+ pub fn shr ( self , rhs : Self ) -> Self {
156
+ unimplemented ! ( )
157
+ }
158
+
159
+ pub fn sub ( self , rhs : Self ) -> Self {
160
+ unimplemented ! ( )
42
161
}
162
+ // *****************
163
+ // complete list end
164
+ // *****************
165
+ }
166
+
167
+ pub struct T1 ;
168
+ impl T1 {
169
+ // corner cases: should not lint
43
170
44
171
// no error, not public interface
45
172
pub ( crate ) fn drop ( & mut self ) { }
@@ -50,22 +177,22 @@ impl T {
50
177
}
51
178
52
179
// no error, private function
53
- fn eq ( & self , other : T ) -> bool {
180
+ fn eq ( & self , other : Self ) -> bool {
54
181
true
55
182
}
56
183
57
184
// No error; self is a ref.
58
- fn sub ( & self , other : T ) -> & T {
185
+ fn sub ( & self , other : Self ) -> & Self {
59
186
self
60
187
}
61
188
62
189
// No error; different number of arguments.
63
- fn div ( self ) -> T {
190
+ fn div ( self ) -> Self {
64
191
self
65
192
}
66
193
67
194
// No error; wrong return type.
68
- fn rem ( self , other : T ) { }
195
+ fn rem ( self , other : Self ) { }
69
196
70
197
// Fine
71
198
fn into_u32 ( self ) -> u32 {
@@ -89,16 +216,15 @@ impl T {
89
216
}
90
217
}
91
218
92
- pub struct T1 ;
93
-
94
- impl T1 {
219
+ pub struct T2 ;
220
+ impl T2 {
95
221
// Shouldn't trigger lint as it is unsafe.
96
- pub unsafe fn add ( self , rhs : T1 ) -> T1 {
222
+ pub unsafe fn add ( self , rhs : Self ) -> Self {
97
223
self
98
224
}
99
225
100
226
// Should not trigger lint since this is an async function.
101
- pub async fn next ( & mut self ) -> Option < T1 > {
227
+ pub async fn next ( & mut self ) -> Option < Self > {
102
228
None
103
229
}
104
230
}
0 commit comments