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