@@ -84,143 +84,149 @@ error: casting raw pointers to the same type and constness is unnecessary (`*con
8484LL | uwu::<u32, u8>([1u32].as_ptr()) as *const u8;
8585 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `uwu::<u32, u8>([1u32].as_ptr())`
8686
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+
8793error: casting integer literal to `f32` is unnecessary
88- --> $DIR/unnecessary_cast.rs:91 :9
94+ --> $DIR/unnecessary_cast.rs:93 :9
8995 |
9096LL | 100 as f32;
9197 | ^^^^^^^^^^ help: try: `100_f32`
9298
9399error: casting integer literal to `f64` is unnecessary
94- --> $DIR/unnecessary_cast.rs:92 :9
100+ --> $DIR/unnecessary_cast.rs:94 :9
95101 |
96102LL | 100 as f64;
97103 | ^^^^^^^^^^ help: try: `100_f64`
98104
99105error: casting integer literal to `f64` is unnecessary
100- --> $DIR/unnecessary_cast.rs:93 :9
106+ --> $DIR/unnecessary_cast.rs:95 :9
101107 |
102108LL | 100_i32 as f64;
103109 | ^^^^^^^^^^^^^^ help: try: `100_f64`
104110
105111error: casting integer literal to `f32` is unnecessary
106- --> $DIR/unnecessary_cast.rs:94 :17
112+ --> $DIR/unnecessary_cast.rs:96 :17
107113 |
108114LL | let _ = -100 as f32;
109115 | ^^^^^^^^^^^ help: try: `-100_f32`
110116
111117error: casting integer literal to `f64` is unnecessary
112- --> $DIR/unnecessary_cast.rs:95 :17
118+ --> $DIR/unnecessary_cast.rs:97 :17
113119 |
114120LL | let _ = -100 as f64;
115121 | ^^^^^^^^^^^ help: try: `-100_f64`
116122
117123error: casting integer literal to `f64` is unnecessary
118- --> $DIR/unnecessary_cast.rs:96 :17
124+ --> $DIR/unnecessary_cast.rs:98 :17
119125 |
120126LL | let _ = -100_i32 as f64;
121127 | ^^^^^^^^^^^^^^^ help: try: `-100_f64`
122128
123129error: casting float literal to `f32` is unnecessary
124- --> $DIR/unnecessary_cast.rs:97 :9
130+ --> $DIR/unnecessary_cast.rs:99 :9
125131 |
126132LL | 100. as f32;
127133 | ^^^^^^^^^^^ help: try: `100_f32`
128134
129135error: casting float literal to `f64` is unnecessary
130- --> $DIR/unnecessary_cast.rs:98 :9
136+ --> $DIR/unnecessary_cast.rs:100 :9
131137 |
132138LL | 100. as f64;
133139 | ^^^^^^^^^^^ help: try: `100_f64`
134140
135141error: casting integer literal to `u32` is unnecessary
136- --> $DIR/unnecessary_cast.rs:110 :9
142+ --> $DIR/unnecessary_cast.rs:112 :9
137143 |
138144LL | 1 as u32;
139145 | ^^^^^^^^ help: try: `1_u32`
140146
141147error: casting integer literal to `i32` is unnecessary
142- --> $DIR/unnecessary_cast.rs:111 :9
148+ --> $DIR/unnecessary_cast.rs:113 :9
143149 |
144150LL | 0x10 as i32;
145151 | ^^^^^^^^^^^ help: try: `0x10_i32`
146152
147153error: casting integer literal to `usize` is unnecessary
148- --> $DIR/unnecessary_cast.rs:112 :9
154+ --> $DIR/unnecessary_cast.rs:114 :9
149155 |
150156LL | 0b10 as usize;
151157 | ^^^^^^^^^^^^^ help: try: `0b10_usize`
152158
153159error: casting integer literal to `u16` is unnecessary
154- --> $DIR/unnecessary_cast.rs:113 :9
160+ --> $DIR/unnecessary_cast.rs:115 :9
155161 |
156162LL | 0o73 as u16;
157163 | ^^^^^^^^^^^ help: try: `0o73_u16`
158164
159165error: casting integer literal to `u32` is unnecessary
160- --> $DIR/unnecessary_cast.rs:114 :9
166+ --> $DIR/unnecessary_cast.rs:116 :9
161167 |
162168LL | 1_000_000_000 as u32;
163169 | ^^^^^^^^^^^^^^^^^^^^ help: try: `1_000_000_000_u32`
164170
165171error: casting float literal to `f64` is unnecessary
166- --> $DIR/unnecessary_cast.rs:116 :9
172+ --> $DIR/unnecessary_cast.rs:118 :9
167173 |
168174LL | 1.0 as f64;
169175 | ^^^^^^^^^^ help: try: `1.0_f64`
170176
171177error: casting float literal to `f32` is unnecessary
172- --> $DIR/unnecessary_cast.rs:117 :9
178+ --> $DIR/unnecessary_cast.rs:119 :9
173179 |
174180LL | 0.5 as f32;
175181 | ^^^^^^^^^^ help: try: `0.5_f32`
176182
177183error: casting integer literal to `i32` is unnecessary
178- --> $DIR/unnecessary_cast.rs:121 :17
184+ --> $DIR/unnecessary_cast.rs:123 :17
179185 |
180186LL | let _ = -1 as i32;
181187 | ^^^^^^^^^ help: try: `-1_i32`
182188
183189error: casting float literal to `f32` is unnecessary
184- --> $DIR/unnecessary_cast.rs:122 :17
190+ --> $DIR/unnecessary_cast.rs:124 :17
185191 |
186192LL | let _ = -1.0 as f32;
187193 | ^^^^^^^^^^^ help: try: `-1.0_f32`
188194
189195error: casting to the same type is unnecessary (`i32` -> `i32`)
190- --> $DIR/unnecessary_cast.rs:128 :18
196+ --> $DIR/unnecessary_cast.rs:130 :18
191197 |
192198LL | let _ = &(x as i32);
193199 | ^^^^^^^^^^ help: try: `{ x }`
194200
195201error: casting integer literal to `i32` is unnecessary
196- --> $DIR/unnecessary_cast.rs:134 :22
202+ --> $DIR/unnecessary_cast.rs:136 :22
197203 |
198204LL | let _: i32 = -(1) as i32;
199205 | ^^^^^^^^^^^ help: try: `-1_i32`
200206
201207error: casting integer literal to `i64` is unnecessary
202- --> $DIR/unnecessary_cast.rs:136 :22
208+ --> $DIR/unnecessary_cast.rs:138 :22
203209 |
204210LL | let _: i64 = -(1) as i64;
205211 | ^^^^^^^^^^^ help: try: `-1_i64`
206212
207213error: casting float literal to `f64` is unnecessary
208- --> $DIR/unnecessary_cast.rs:143 :22
214+ --> $DIR/unnecessary_cast.rs:145 :22
209215 |
210216LL | let _: f64 = (-8.0 as f64).exp();
211217 | ^^^^^^^^^^^^^ help: try: `(-8.0_f64)`
212218
213219error: casting float literal to `f64` is unnecessary
214- --> $DIR/unnecessary_cast.rs:145 :23
220+ --> $DIR/unnecessary_cast.rs:147 :23
215221 |
216222LL | let _: f64 = -(8.0 as f64).exp(); // should suggest `-8.0_f64.exp()` here not to change code behavior
217223 | ^^^^^^^^^^^^ help: try: `8.0_f64`
218224
219225error: casting to the same type is unnecessary (`f32` -> `f32`)
220- --> $DIR/unnecessary_cast.rs:153 :20
226+ --> $DIR/unnecessary_cast.rs:155 :20
221227 |
222228LL | let _num = foo() as f32;
223229 | ^^^^^^^^^^^^ help: try: `foo()`
224230
225- error: aborting due to 37 previous errors
231+ error: aborting due to 38 previous errors
226232
0 commit comments