@@ -84,143 +84,149 @@ error: casting raw pointers to the same type and constness is unnecessary (`*con
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
+ error: casting raw pointers to the same type and constness is unnecessary (`*const u32` -> `*const u32`)
88
+ --> $DIR/unnecessary_cast.rs:52:5
89
+ |
90
+ LL | uwu::<u32, u32>([1u32].as_ptr()) as *const u32;
91
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `uwu::<u32, u32>([1u32].as_ptr())`
92
+
87
93
error: casting integer literal to `f32` is unnecessary
88
- --> $DIR/unnecessary_cast.rs:91 :9
94
+ --> $DIR/unnecessary_cast.rs:93 :9
89
95
|
90
96
LL | 100 as f32;
91
97
| ^^^^^^^^^^ help: try: `100_f32`
92
98
93
99
error: casting integer literal to `f64` is unnecessary
94
- --> $DIR/unnecessary_cast.rs:92 :9
100
+ --> $DIR/unnecessary_cast.rs:94 :9
95
101
|
96
102
LL | 100 as f64;
97
103
| ^^^^^^^^^^ help: try: `100_f64`
98
104
99
105
error: casting integer literal to `f64` is unnecessary
100
- --> $DIR/unnecessary_cast.rs:93 :9
106
+ --> $DIR/unnecessary_cast.rs:95 :9
101
107
|
102
108
LL | 100_i32 as f64;
103
109
| ^^^^^^^^^^^^^^ help: try: `100_f64`
104
110
105
111
error: casting integer literal to `f32` is unnecessary
106
- --> $DIR/unnecessary_cast.rs:94 :17
112
+ --> $DIR/unnecessary_cast.rs:96 :17
107
113
|
108
114
LL | let _ = -100 as f32;
109
115
| ^^^^^^^^^^^ help: try: `-100_f32`
110
116
111
117
error: casting integer literal to `f64` is unnecessary
112
- --> $DIR/unnecessary_cast.rs:95 :17
118
+ --> $DIR/unnecessary_cast.rs:97 :17
113
119
|
114
120
LL | let _ = -100 as f64;
115
121
| ^^^^^^^^^^^ help: try: `-100_f64`
116
122
117
123
error: casting integer literal to `f64` is unnecessary
118
- --> $DIR/unnecessary_cast.rs:96 :17
124
+ --> $DIR/unnecessary_cast.rs:98 :17
119
125
|
120
126
LL | let _ = -100_i32 as f64;
121
127
| ^^^^^^^^^^^^^^^ help: try: `-100_f64`
122
128
123
129
error: casting float literal to `f32` is unnecessary
124
- --> $DIR/unnecessary_cast.rs:97 :9
130
+ --> $DIR/unnecessary_cast.rs:99 :9
125
131
|
126
132
LL | 100. as f32;
127
133
| ^^^^^^^^^^^ help: try: `100_f32`
128
134
129
135
error: casting float literal to `f64` is unnecessary
130
- --> $DIR/unnecessary_cast.rs:98 :9
136
+ --> $DIR/unnecessary_cast.rs:100 :9
131
137
|
132
138
LL | 100. as f64;
133
139
| ^^^^^^^^^^^ help: try: `100_f64`
134
140
135
141
error: casting integer literal to `u32` is unnecessary
136
- --> $DIR/unnecessary_cast.rs:110 :9
142
+ --> $DIR/unnecessary_cast.rs:112 :9
137
143
|
138
144
LL | 1 as u32;
139
145
| ^^^^^^^^ help: try: `1_u32`
140
146
141
147
error: casting integer literal to `i32` is unnecessary
142
- --> $DIR/unnecessary_cast.rs:111 :9
148
+ --> $DIR/unnecessary_cast.rs:113 :9
143
149
|
144
150
LL | 0x10 as i32;
145
151
| ^^^^^^^^^^^ help: try: `0x10_i32`
146
152
147
153
error: casting integer literal to `usize` is unnecessary
148
- --> $DIR/unnecessary_cast.rs:112 :9
154
+ --> $DIR/unnecessary_cast.rs:114 :9
149
155
|
150
156
LL | 0b10 as usize;
151
157
| ^^^^^^^^^^^^^ help: try: `0b10_usize`
152
158
153
159
error: casting integer literal to `u16` is unnecessary
154
- --> $DIR/unnecessary_cast.rs:113 :9
160
+ --> $DIR/unnecessary_cast.rs:115 :9
155
161
|
156
162
LL | 0o73 as u16;
157
163
| ^^^^^^^^^^^ help: try: `0o73_u16`
158
164
159
165
error: casting integer literal to `u32` is unnecessary
160
- --> $DIR/unnecessary_cast.rs:114 :9
166
+ --> $DIR/unnecessary_cast.rs:116 :9
161
167
|
162
168
LL | 1_000_000_000 as u32;
163
169
| ^^^^^^^^^^^^^^^^^^^^ help: try: `1_000_000_000_u32`
164
170
165
171
error: casting float literal to `f64` is unnecessary
166
- --> $DIR/unnecessary_cast.rs:116 :9
172
+ --> $DIR/unnecessary_cast.rs:118 :9
167
173
|
168
174
LL | 1.0 as f64;
169
175
| ^^^^^^^^^^ help: try: `1.0_f64`
170
176
171
177
error: casting float literal to `f32` is unnecessary
172
- --> $DIR/unnecessary_cast.rs:117 :9
178
+ --> $DIR/unnecessary_cast.rs:119 :9
173
179
|
174
180
LL | 0.5 as f32;
175
181
| ^^^^^^^^^^ help: try: `0.5_f32`
176
182
177
183
error: casting integer literal to `i32` is unnecessary
178
- --> $DIR/unnecessary_cast.rs:121 :17
184
+ --> $DIR/unnecessary_cast.rs:123 :17
179
185
|
180
186
LL | let _ = -1 as i32;
181
187
| ^^^^^^^^^ help: try: `-1_i32`
182
188
183
189
error: casting float literal to `f32` is unnecessary
184
- --> $DIR/unnecessary_cast.rs:122 :17
190
+ --> $DIR/unnecessary_cast.rs:124 :17
185
191
|
186
192
LL | let _ = -1.0 as f32;
187
193
| ^^^^^^^^^^^ help: try: `-1.0_f32`
188
194
189
195
error: casting to the same type is unnecessary (`i32` -> `i32`)
190
- --> $DIR/unnecessary_cast.rs:128 :18
196
+ --> $DIR/unnecessary_cast.rs:130 :18
191
197
|
192
198
LL | let _ = &(x as i32);
193
199
| ^^^^^^^^^^ help: try: `{ x }`
194
200
195
201
error: casting integer literal to `i32` is unnecessary
196
- --> $DIR/unnecessary_cast.rs:134 :22
202
+ --> $DIR/unnecessary_cast.rs:136 :22
197
203
|
198
204
LL | let _: i32 = -(1) as i32;
199
205
| ^^^^^^^^^^^ help: try: `-1_i32`
200
206
201
207
error: casting integer literal to `i64` is unnecessary
202
- --> $DIR/unnecessary_cast.rs:136 :22
208
+ --> $DIR/unnecessary_cast.rs:138 :22
203
209
|
204
210
LL | let _: i64 = -(1) as i64;
205
211
| ^^^^^^^^^^^ help: try: `-1_i64`
206
212
207
213
error: casting float literal to `f64` is unnecessary
208
- --> $DIR/unnecessary_cast.rs:143 :22
214
+ --> $DIR/unnecessary_cast.rs:145 :22
209
215
|
210
216
LL | let _: f64 = (-8.0 as f64).exp();
211
217
| ^^^^^^^^^^^^^ help: try: `(-8.0_f64)`
212
218
213
219
error: casting float literal to `f64` is unnecessary
214
- --> $DIR/unnecessary_cast.rs:145 :23
220
+ --> $DIR/unnecessary_cast.rs:147 :23
215
221
|
216
222
LL | let _: f64 = -(8.0 as f64).exp(); // should suggest `-8.0_f64.exp()` here not to change code behavior
217
223
| ^^^^^^^^^^^^ help: try: `8.0_f64`
218
224
219
225
error: casting to the same type is unnecessary (`f32` -> `f32`)
220
- --> $DIR/unnecessary_cast.rs:153 :20
226
+ --> $DIR/unnecessary_cast.rs:155 :20
221
227
|
222
228
LL | let _num = foo() as f32;
223
229
| ^^^^^^^^^^^^ help: try: `foo()`
224
230
225
- error: aborting due to 37 previous errors
231
+ error: aborting due to 38 previous errors
226
232
0 commit comments