blob: 58fac2d406a0f83c6c6652550b81532da90c4a22 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
|
error: casting function pointer `foo` to `i8`
--> tests/ui/fn_to_numeric_cast_any.rs:23:13
|
LL | let _ = foo as i8;
| ^^^^^^^^^
|
= note: `-D clippy::fn-to-numeric-cast-any` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::fn_to_numeric_cast_any)]`
help: did you mean to invoke the function?
|
LL | let _ = foo() as i8;
| ++
error: casting function pointer `foo` to `i16`
--> tests/ui/fn_to_numeric_cast_any.rs:26:13
|
LL | let _ = foo as i16;
| ^^^^^^^^^^
|
help: did you mean to invoke the function?
|
LL | let _ = foo() as i16;
| ++
error: casting function pointer `foo` to `i32`
--> tests/ui/fn_to_numeric_cast_any.rs:29:13
|
LL | let _ = foo as i32;
| ^^^^^^^^^^
|
help: did you mean to invoke the function?
|
LL | let _ = foo() as i32;
| ++
error: casting function pointer `foo` to `i64`
--> tests/ui/fn_to_numeric_cast_any.rs:32:13
|
LL | let _ = foo as i64;
| ^^^^^^^^^^
|
help: did you mean to invoke the function?
|
LL | let _ = foo() as i64;
| ++
error: casting function pointer `foo` to `i128`
--> tests/ui/fn_to_numeric_cast_any.rs:35:13
|
LL | let _ = foo as i128;
| ^^^^^^^^^^^
|
help: did you mean to invoke the function?
|
LL | let _ = foo() as i128;
| ++
error: casting function pointer `foo` to `isize`
--> tests/ui/fn_to_numeric_cast_any.rs:38:13
|
LL | let _ = foo as isize;
| ^^^^^^^^^^^^
|
help: did you mean to invoke the function?
|
LL | let _ = foo() as isize;
| ++
error: casting function pointer `foo` to `u8`
--> tests/ui/fn_to_numeric_cast_any.rs:41:13
|
LL | let _ = foo as u8;
| ^^^^^^^^^
|
help: did you mean to invoke the function?
|
LL | let _ = foo() as u8;
| ++
error: casting function pointer `foo` to `u16`
--> tests/ui/fn_to_numeric_cast_any.rs:44:13
|
LL | let _ = foo as u16;
| ^^^^^^^^^^
|
help: did you mean to invoke the function?
|
LL | let _ = foo() as u16;
| ++
error: casting function pointer `foo` to `u32`
--> tests/ui/fn_to_numeric_cast_any.rs:47:13
|
LL | let _ = foo as u32;
| ^^^^^^^^^^
|
help: did you mean to invoke the function?
|
LL | let _ = foo() as u32;
| ++
error: casting function pointer `foo` to `u64`
--> tests/ui/fn_to_numeric_cast_any.rs:50:13
|
LL | let _ = foo as u64;
| ^^^^^^^^^^
|
help: did you mean to invoke the function?
|
LL | let _ = foo() as u64;
| ++
error: casting function pointer `foo` to `u128`
--> tests/ui/fn_to_numeric_cast_any.rs:53:13
|
LL | let _ = foo as u128;
| ^^^^^^^^^^^
|
help: did you mean to invoke the function?
|
LL | let _ = foo() as u128;
| ++
error: casting function pointer `foo` to `usize`
--> tests/ui/fn_to_numeric_cast_any.rs:56:13
|
LL | let _ = foo as usize;
| ^^^^^^^^^^^^
|
help: did you mean to invoke the function?
|
LL | let _ = foo() as usize;
| ++
error: casting function pointer `Struct::static_method` to `usize`
--> tests/ui/fn_to_numeric_cast_any.rs:61:13
|
LL | let _ = Struct::static_method as usize;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: did you mean to invoke the function?
|
LL | let _ = Struct::static_method() as usize;
| ++
error: casting function pointer `f` to `usize`
--> tests/ui/fn_to_numeric_cast_any.rs:66:5
|
LL | f as usize
| ^^^^^^^^^^
|
help: did you mean to invoke the function?
|
LL | f() as usize
| ++
error: casting function pointer `T::static_method` to `usize`
--> tests/ui/fn_to_numeric_cast_any.rs:71:5
|
LL | T::static_method as usize
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: did you mean to invoke the function?
|
LL | T::static_method() as usize
| ++
error: casting function pointer `(clos as fn(u32) -> u32)` to `usize`
--> tests/ui/fn_to_numeric_cast_any.rs:78:13
|
LL | let _ = (clos as fn(u32) -> u32) as usize;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: did you mean to invoke the function?
|
LL | let _ = (clos as fn(u32) -> u32)() as usize;
| ++
error: casting function pointer `foo` to `*const ()`
--> tests/ui/fn_to_numeric_cast_any.rs:83:13
|
LL | let _ = foo as *const ();
| ^^^^^^^^^^^^^^^^
|
help: did you mean to invoke the function?
|
LL | let _ = foo() as *const ();
| ++
error: aborting due to 17 previous errors
|