1
1
error: casting raw pointers to the same type and constness is unnecessary (`*const T` -> `*const T`)
2
- --> tests/ui/unnecessary_cast.rs:18 :5
2
+ --> tests/ui/unnecessary_cast.rs:19 :5
3
3
|
4
4
LL | ptr as *const T
5
5
| ^^^^^^^^^^^^^^^ help: try: `ptr`
@@ -8,235 +8,235 @@ LL | ptr as *const T
8
8
= help: to override `-D warnings` add `#[allow(clippy::unnecessary_cast)]`
9
9
10
10
error: casting integer literal to `i32` is unnecessary
11
- --> tests/ui/unnecessary_cast.rs:53 :5
11
+ --> tests/ui/unnecessary_cast.rs:54 :5
12
12
|
13
13
LL | 1i32 as i32;
14
14
| ^^^^^^^^^^^ help: try: `1_i32`
15
15
16
16
error: casting float literal to `f32` is unnecessary
17
- --> tests/ui/unnecessary_cast.rs:54 :5
17
+ --> tests/ui/unnecessary_cast.rs:55 :5
18
18
|
19
19
LL | 1f32 as f32;
20
20
| ^^^^^^^^^^^ help: try: `1_f32`
21
21
22
22
error: casting to the same type is unnecessary (`bool` -> `bool`)
23
- --> tests/ui/unnecessary_cast.rs:55 :5
23
+ --> tests/ui/unnecessary_cast.rs:56 :5
24
24
|
25
25
LL | false as bool;
26
26
| ^^^^^^^^^^^^^ help: try: `false`
27
27
28
28
error: casting integer literal to `i32` is unnecessary
29
- --> tests/ui/unnecessary_cast.rs:58 :5
29
+ --> tests/ui/unnecessary_cast.rs:59 :5
30
30
|
31
31
LL | -1_i32 as i32;
32
32
| ^^^^^^^^^^^^^ help: try: `-1_i32`
33
33
34
34
error: casting integer literal to `i32` is unnecessary
35
- --> tests/ui/unnecessary_cast.rs:59 :5
35
+ --> tests/ui/unnecessary_cast.rs:60 :5
36
36
|
37
37
LL | - 1_i32 as i32;
38
38
| ^^^^^^^^^^^^^^ help: try: `- 1_i32`
39
39
40
40
error: casting float literal to `f32` is unnecessary
41
- --> tests/ui/unnecessary_cast.rs:60 :5
41
+ --> tests/ui/unnecessary_cast.rs:61 :5
42
42
|
43
43
LL | -1f32 as f32;
44
44
| ^^^^^^^^^^^^ help: try: `-1_f32`
45
45
46
46
error: casting integer literal to `i32` is unnecessary
47
- --> tests/ui/unnecessary_cast.rs:61 :5
47
+ --> tests/ui/unnecessary_cast.rs:62 :5
48
48
|
49
49
LL | 1_i32 as i32;
50
50
| ^^^^^^^^^^^^ help: try: `1_i32`
51
51
52
52
error: casting float literal to `f32` is unnecessary
53
- --> tests/ui/unnecessary_cast.rs:62 :5
53
+ --> tests/ui/unnecessary_cast.rs:63 :5
54
54
|
55
55
LL | 1_f32 as f32;
56
56
| ^^^^^^^^^^^^ help: try: `1_f32`
57
57
58
58
error: casting raw pointers to the same type and constness is unnecessary (`*const u8` -> `*const u8`)
59
- --> tests/ui/unnecessary_cast.rs:64 :22
59
+ --> tests/ui/unnecessary_cast.rs:65 :22
60
60
|
61
61
LL | let _: *mut u8 = [1u8, 2].as_ptr() as *const u8 as *mut u8;
62
62
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `[1u8, 2].as_ptr()`
63
63
64
64
error: casting raw pointers to the same type and constness is unnecessary (`*const u8` -> `*const u8`)
65
- --> tests/ui/unnecessary_cast.rs:66 :5
65
+ --> tests/ui/unnecessary_cast.rs:67 :5
66
66
|
67
67
LL | [1u8, 2].as_ptr() as *const u8;
68
68
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `[1u8, 2].as_ptr()`
69
69
70
70
error: casting raw pointers to the same type and constness is unnecessary (`*mut u8` -> `*mut u8`)
71
- --> tests/ui/unnecessary_cast.rs:68 :5
71
+ --> tests/ui/unnecessary_cast.rs:69 :5
72
72
|
73
73
LL | [1u8, 2].as_mut_ptr() as *mut u8;
74
74
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `[1u8, 2].as_mut_ptr()`
75
75
76
76
error: casting raw pointers to the same type and constness is unnecessary (`*const u32` -> `*const u32`)
77
- --> tests/ui/unnecessary_cast.rs:79 :5
77
+ --> tests/ui/unnecessary_cast.rs:80 :5
78
78
|
79
79
LL | owo::<u32>([1u32].as_ptr()) as *const u32;
80
80
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `owo::<u32>([1u32].as_ptr())`
81
81
82
82
error: casting raw pointers to the same type and constness is unnecessary (`*const u8` -> `*const u8`)
83
- --> tests/ui/unnecessary_cast.rs:80 :5
83
+ --> tests/ui/unnecessary_cast.rs:81 :5
84
84
|
85
85
LL | uwu::<u32, u8>([1u32].as_ptr()) as *const u8;
86
86
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `uwu::<u32, u8>([1u32].as_ptr())`
87
87
88
88
error: casting raw pointers to the same type and constness is unnecessary (`*const u32` -> `*const u32`)
89
- --> tests/ui/unnecessary_cast.rs:82 :5
89
+ --> tests/ui/unnecessary_cast.rs:83 :5
90
90
|
91
91
LL | uwu::<u32, u32>([1u32].as_ptr()) as *const u32;
92
92
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `uwu::<u32, u32>([1u32].as_ptr())`
93
93
94
94
error: casting to the same type is unnecessary (`u32` -> `u32`)
95
- --> tests/ui/unnecessary_cast.rs:117 :5
95
+ --> tests/ui/unnecessary_cast.rs:118 :5
96
96
|
97
97
LL | aaa() as u32;
98
98
| ^^^^^^^^^^^^ help: try: `aaa()`
99
99
100
100
error: casting to the same type is unnecessary (`u32` -> `u32`)
101
- --> tests/ui/unnecessary_cast.rs:119 :5
101
+ --> tests/ui/unnecessary_cast.rs:120 :5
102
102
|
103
103
LL | aaa() as u32;
104
104
| ^^^^^^^^^^^^ help: try: `aaa()`
105
105
106
106
error: casting integer literal to `f32` is unnecessary
107
- --> tests/ui/unnecessary_cast.rs:155 :9
107
+ --> tests/ui/unnecessary_cast.rs:156 :9
108
108
|
109
109
LL | 100 as f32;
110
110
| ^^^^^^^^^^ help: try: `100_f32`
111
111
112
112
error: casting integer literal to `f64` is unnecessary
113
- --> tests/ui/unnecessary_cast.rs:156 :9
113
+ --> tests/ui/unnecessary_cast.rs:157 :9
114
114
|
115
115
LL | 100 as f64;
116
116
| ^^^^^^^^^^ help: try: `100_f64`
117
117
118
118
error: casting integer literal to `f64` is unnecessary
119
- --> tests/ui/unnecessary_cast.rs:157 :9
119
+ --> tests/ui/unnecessary_cast.rs:158 :9
120
120
|
121
121
LL | 100_i32 as f64;
122
122
| ^^^^^^^^^^^^^^ help: try: `100_f64`
123
123
124
124
error: casting integer literal to `f32` is unnecessary
125
- --> tests/ui/unnecessary_cast.rs:158 :17
125
+ --> tests/ui/unnecessary_cast.rs:159 :17
126
126
|
127
127
LL | let _ = -100 as f32;
128
128
| ^^^^^^^^^^^ help: try: `-100_f32`
129
129
130
130
error: casting integer literal to `f64` is unnecessary
131
- --> tests/ui/unnecessary_cast.rs:159 :17
131
+ --> tests/ui/unnecessary_cast.rs:160 :17
132
132
|
133
133
LL | let _ = -100 as f64;
134
134
| ^^^^^^^^^^^ help: try: `-100_f64`
135
135
136
136
error: casting integer literal to `f64` is unnecessary
137
- --> tests/ui/unnecessary_cast.rs:160 :17
137
+ --> tests/ui/unnecessary_cast.rs:161 :17
138
138
|
139
139
LL | let _ = -100_i32 as f64;
140
140
| ^^^^^^^^^^^^^^^ help: try: `-100_f64`
141
141
142
142
error: casting float literal to `f32` is unnecessary
143
- --> tests/ui/unnecessary_cast.rs:161 :9
143
+ --> tests/ui/unnecessary_cast.rs:162 :9
144
144
|
145
145
LL | 100. as f32;
146
146
| ^^^^^^^^^^^ help: try: `100_f32`
147
147
148
148
error: casting float literal to `f64` is unnecessary
149
- --> tests/ui/unnecessary_cast.rs:162 :9
149
+ --> tests/ui/unnecessary_cast.rs:163 :9
150
150
|
151
151
LL | 100. as f64;
152
152
| ^^^^^^^^^^^ help: try: `100_f64`
153
153
154
154
error: casting integer literal to `u32` is unnecessary
155
- --> tests/ui/unnecessary_cast.rs:174 :9
155
+ --> tests/ui/unnecessary_cast.rs:175 :9
156
156
|
157
157
LL | 1 as u32;
158
158
| ^^^^^^^^ help: try: `1_u32`
159
159
160
160
error: casting integer literal to `i32` is unnecessary
161
- --> tests/ui/unnecessary_cast.rs:175 :9
161
+ --> tests/ui/unnecessary_cast.rs:176 :9
162
162
|
163
163
LL | 0x10 as i32;
164
164
| ^^^^^^^^^^^ help: try: `0x10_i32`
165
165
166
166
error: casting integer literal to `usize` is unnecessary
167
- --> tests/ui/unnecessary_cast.rs:176 :9
167
+ --> tests/ui/unnecessary_cast.rs:177 :9
168
168
|
169
169
LL | 0b10 as usize;
170
170
| ^^^^^^^^^^^^^ help: try: `0b10_usize`
171
171
172
172
error: casting integer literal to `u16` is unnecessary
173
- --> tests/ui/unnecessary_cast.rs:177 :9
173
+ --> tests/ui/unnecessary_cast.rs:178 :9
174
174
|
175
175
LL | 0o73 as u16;
176
176
| ^^^^^^^^^^^ help: try: `0o73_u16`
177
177
178
178
error: casting integer literal to `u32` is unnecessary
179
- --> tests/ui/unnecessary_cast.rs:178 :9
179
+ --> tests/ui/unnecessary_cast.rs:179 :9
180
180
|
181
181
LL | 1_000_000_000 as u32;
182
182
| ^^^^^^^^^^^^^^^^^^^^ help: try: `1_000_000_000_u32`
183
183
184
184
error: casting float literal to `f64` is unnecessary
185
- --> tests/ui/unnecessary_cast.rs:180 :9
185
+ --> tests/ui/unnecessary_cast.rs:181 :9
186
186
|
187
187
LL | 1.0 as f64;
188
188
| ^^^^^^^^^^ help: try: `1.0_f64`
189
189
190
190
error: casting float literal to `f32` is unnecessary
191
- --> tests/ui/unnecessary_cast.rs:181 :9
191
+ --> tests/ui/unnecessary_cast.rs:182 :9
192
192
|
193
193
LL | 0.5 as f32;
194
194
| ^^^^^^^^^^ help: try: `0.5_f32`
195
195
196
196
error: casting integer literal to `i32` is unnecessary
197
- --> tests/ui/unnecessary_cast.rs:185 :17
197
+ --> tests/ui/unnecessary_cast.rs:186 :17
198
198
|
199
199
LL | let _ = -1 as i32;
200
200
| ^^^^^^^^^ help: try: `-1_i32`
201
201
202
202
error: casting float literal to `f32` is unnecessary
203
- --> tests/ui/unnecessary_cast.rs:186 :17
203
+ --> tests/ui/unnecessary_cast.rs:187 :17
204
204
|
205
205
LL | let _ = -1.0 as f32;
206
206
| ^^^^^^^^^^^ help: try: `-1.0_f32`
207
207
208
208
error: casting to the same type is unnecessary (`i32` -> `i32`)
209
- --> tests/ui/unnecessary_cast.rs:192 :18
209
+ --> tests/ui/unnecessary_cast.rs:193 :18
210
210
|
211
211
LL | let _ = &(x as i32);
212
212
| ^^^^^^^^^^ help: try: `{ x }`
213
213
214
214
error: casting integer literal to `i32` is unnecessary
215
- --> tests/ui/unnecessary_cast.rs:198 :22
215
+ --> tests/ui/unnecessary_cast.rs:199 :22
216
216
|
217
217
LL | let _: i32 = -(1) as i32;
218
218
| ^^^^^^^^^^^ help: try: `-1_i32`
219
219
220
220
error: casting integer literal to `i64` is unnecessary
221
- --> tests/ui/unnecessary_cast.rs:200 :22
221
+ --> tests/ui/unnecessary_cast.rs:201 :22
222
222
|
223
223
LL | let _: i64 = -(1) as i64;
224
224
| ^^^^^^^^^^^ help: try: `-1_i64`
225
225
226
226
error: casting float literal to `f64` is unnecessary
227
- --> tests/ui/unnecessary_cast.rs:207 :22
227
+ --> tests/ui/unnecessary_cast.rs:208 :22
228
228
|
229
229
LL | let _: f64 = (-8.0 as f64).exp();
230
230
| ^^^^^^^^^^^^^ help: try: `(-8.0_f64)`
231
231
232
232
error: casting float literal to `f64` is unnecessary
233
- --> tests/ui/unnecessary_cast.rs:209 :23
233
+ --> tests/ui/unnecessary_cast.rs:210 :23
234
234
|
235
235
LL | let _: f64 = -(8.0 as f64).exp(); // should suggest `-8.0_f64.exp()` here not to change code behavior
236
236
| ^^^^^^^^^^^^ help: try: `8.0_f64`
237
237
238
238
error: casting to the same type is unnecessary (`f32` -> `f32`)
239
- --> tests/ui/unnecessary_cast.rs:217 :20
239
+ --> tests/ui/unnecessary_cast.rs:218 :20
240
240
|
241
241
LL | let _num = foo() as f32;
242
242
| ^^^^^^^^^^^^ help: try: `foo()`
0 commit comments