@@ -148,8 +148,56 @@ error: transmute from a `i128` to a `f128`
148148LL | let _: f128 = unsafe { std::mem::transmute(0_i128) };
149149 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `f128::from_bits(0_i128 as u128)`
150150
151+ error: transmute from a `u16` to a `f16`
152+ --> tests/ui/transmute.rs:142:39
153+ |
154+ LL | const VALUE16: f16 = unsafe { std::mem::transmute(0_u16) };
155+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `f16::from_bits(0_u16)`
156+
157+ error: transmute from a `u32` to a `f32`
158+ --> tests/ui/transmute.rs:144:39
159+ |
160+ LL | const VALUE32: f32 = unsafe { std::mem::transmute(0_u32) };
161+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `f32::from_bits(0_u32)`
162+
163+ error: transmute from a `i64` to a `f64`
164+ --> tests/ui/transmute.rs:146:39
165+ |
166+ LL | const VALUE64: f64 = unsafe { std::mem::transmute(0_i64) };
167+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `f64::from_bits(0_i64 as u64)`
168+
169+ error: transmute from a `i128` to a `f128`
170+ --> tests/ui/transmute.rs:148:41
171+ |
172+ LL | const VALUE128: f128 = unsafe { std::mem::transmute(0_i128) };
173+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `f128::from_bits(0_i128 as u128)`
174+
175+ error: transmute from a `i16` to a `f16`
176+ --> tests/ui/transmute.rs:152:22
177+ |
178+ LL | unsafe { std::mem::transmute(v) }
179+ | ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `f16::from_bits(v as u16)`
180+
181+ error: transmute from a `i32` to a `f32`
182+ --> tests/ui/transmute.rs:157:22
183+ |
184+ LL | unsafe { std::mem::transmute(v) }
185+ | ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `f32::from_bits(v as u32)`
186+
187+ error: transmute from a `u64` to a `f64`
188+ --> tests/ui/transmute.rs:162:22
189+ |
190+ LL | unsafe { std::mem::transmute(v) }
191+ | ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `f64::from_bits(v)`
192+
193+ error: transmute from a `u128` to a `f128`
194+ --> tests/ui/transmute.rs:167:22
195+ |
196+ LL | unsafe { std::mem::transmute(v) }
197+ | ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `f128::from_bits(v)`
198+
151199error: transmute from a `u8` to a `[u8; 1]`
152- --> tests/ui/transmute.rs:168 :30
200+ --> tests/ui/transmute.rs:176 :30
153201 |
154202LL | let _: [u8; 1] = std::mem::transmute(0u8);
155203 | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0u8.to_ne_bytes()`
@@ -158,97 +206,121 @@ LL | let _: [u8; 1] = std::mem::transmute(0u8);
158206 = help: to override `-D warnings` add `#[allow(clippy::transmute_num_to_bytes)]`
159207
160208error: transmute from a `u32` to a `[u8; 4]`
161- --> tests/ui/transmute.rs:171 :30
209+ --> tests/ui/transmute.rs:179 :30
162210 |
163211LL | let _: [u8; 4] = std::mem::transmute(0u32);
164212 | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0u32.to_ne_bytes()`
165213
166214error: transmute from a `u128` to a `[u8; 16]`
167- --> tests/ui/transmute.rs:173 :31
215+ --> tests/ui/transmute.rs:181 :31
168216 |
169217LL | let _: [u8; 16] = std::mem::transmute(0u128);
170218 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0u128.to_ne_bytes()`
171219
172220error: transmute from a `i8` to a `[u8; 1]`
173- --> tests/ui/transmute.rs:175 :30
221+ --> tests/ui/transmute.rs:183 :30
174222 |
175223LL | let _: [u8; 1] = std::mem::transmute(0i8);
176224 | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0i8.to_ne_bytes()`
177225
178226error: transmute from a `i32` to a `[u8; 4]`
179- --> tests/ui/transmute.rs:177 :30
227+ --> tests/ui/transmute.rs:185 :30
180228 |
181229LL | let _: [u8; 4] = std::mem::transmute(0i32);
182230 | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0i32.to_ne_bytes()`
183231
184232error: transmute from a `i128` to a `[u8; 16]`
185- --> tests/ui/transmute.rs:179 :31
233+ --> tests/ui/transmute.rs:187 :31
186234 |
187235LL | let _: [u8; 16] = std::mem::transmute(0i128);
188236 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0i128.to_ne_bytes()`
189237
190238error: transmute from a `f16` to a `[u8; 2]`
191- --> tests/ui/transmute.rs:182 :30
239+ --> tests/ui/transmute.rs:190 :30
192240 |
193241LL | let _: [u8; 2] = std::mem::transmute(0.0f16);
194242 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0.0f16.to_ne_bytes()`
195243
196244error: transmute from a `f32` to a `[u8; 4]`
197- --> tests/ui/transmute.rs:184 :30
245+ --> tests/ui/transmute.rs:192 :30
198246 |
199247LL | let _: [u8; 4] = std::mem::transmute(0.0f32);
200248 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0.0f32.to_ne_bytes()`
201249
202250error: transmute from a `f64` to a `[u8; 8]`
203- --> tests/ui/transmute.rs:186 :30
251+ --> tests/ui/transmute.rs:194 :30
204252 |
205253LL | let _: [u8; 8] = std::mem::transmute(0.0f64);
206254 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0.0f64.to_ne_bytes()`
207255
208256error: transmute from a `f128` to a `[u8; 16]`
209- --> tests/ui/transmute.rs:188 :31
257+ --> tests/ui/transmute.rs:196 :31
210258 |
211259LL | let _: [u8; 16] = std::mem::transmute(0.0f128);
212260 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0.0f128.to_ne_bytes()`
213261
214262error: transmute from a `u8` to a `[u8; 1]`
215- --> tests/ui/transmute.rs:194 :30
263+ --> tests/ui/transmute.rs:202 :30
216264 |
217265LL | let _: [u8; 1] = std::mem::transmute(0u8);
218266 | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0u8.to_ne_bytes()`
219267
220268error: transmute from a `u32` to a `[u8; 4]`
221- --> tests/ui/transmute.rs:196 :30
269+ --> tests/ui/transmute.rs:204 :30
222270 |
223271LL | let _: [u8; 4] = std::mem::transmute(0u32);
224272 | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0u32.to_ne_bytes()`
225273
226274error: transmute from a `u128` to a `[u8; 16]`
227- --> tests/ui/transmute.rs:198 :31
275+ --> tests/ui/transmute.rs:206 :31
228276 |
229277LL | let _: [u8; 16] = std::mem::transmute(0u128);
230278 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0u128.to_ne_bytes()`
231279
232280error: transmute from a `i8` to a `[u8; 1]`
233- --> tests/ui/transmute.rs:200 :30
281+ --> tests/ui/transmute.rs:208 :30
234282 |
235283LL | let _: [u8; 1] = std::mem::transmute(0i8);
236284 | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0i8.to_ne_bytes()`
237285
238286error: transmute from a `i32` to a `[u8; 4]`
239- --> tests/ui/transmute.rs:202 :30
287+ --> tests/ui/transmute.rs:210 :30
240288 |
241289LL | let _: [u8; 4] = std::mem::transmute(0i32);
242290 | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0i32.to_ne_bytes()`
243291
244292error: transmute from a `i128` to a `[u8; 16]`
245- --> tests/ui/transmute.rs:204 :31
293+ --> tests/ui/transmute.rs:212 :31
246294 |
247295LL | let _: [u8; 16] = std::mem::transmute(0i128);
248296 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0i128.to_ne_bytes()`
249297
298+ error: transmute from a `f16` to a `[u8; 2]`
299+ --> tests/ui/transmute.rs:215:30
300+ |
301+ LL | let _: [u8; 2] = std::mem::transmute(0.0f16);
302+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0.0f16.to_ne_bytes()`
303+
304+ error: transmute from a `f32` to a `[u8; 4]`
305+ --> tests/ui/transmute.rs:217:30
306+ |
307+ LL | let _: [u8; 4] = std::mem::transmute(0.0f32);
308+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0.0f32.to_ne_bytes()`
309+
310+ error: transmute from a `f64` to a `[u8; 8]`
311+ --> tests/ui/transmute.rs:219:30
312+ |
313+ LL | let _: [u8; 8] = std::mem::transmute(0.0f64);
314+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0.0f64.to_ne_bytes()`
315+
316+ error: transmute from a `f128` to a `[u8; 16]`
317+ --> tests/ui/transmute.rs:221:31
318+ |
319+ LL | let _: [u8; 16] = std::mem::transmute(0.0f128);
320+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `to_ne_bytes()`: `0.0f128.to_ne_bytes()`
321+
250322error: transmute from a `&[u8]` to a `&str`
251- --> tests/ui/transmute.rs:218 :28
323+ --> tests/ui/transmute.rs:230 :28
252324 |
253325LL | let _: &str = unsafe { std::mem::transmute(B) };
254326 | ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::str::from_utf8(B).unwrap()`
@@ -257,16 +329,16 @@ LL | let _: &str = unsafe { std::mem::transmute(B) };
257329 = help: to override `-D warnings` add `#[allow(clippy::transmute_bytes_to_str)]`
258330
259331error: transmute from a `&mut [u8]` to a `&mut str`
260- --> tests/ui/transmute.rs:221 :32
332+ --> tests/ui/transmute.rs:233 :32
261333 |
262334LL | let _: &mut str = unsafe { std::mem::transmute(mb) };
263335 | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::str::from_utf8_mut(mb).unwrap()`
264336
265337error: transmute from a `&[u8]` to a `&str`
266- --> tests/ui/transmute.rs:223 :30
338+ --> tests/ui/transmute.rs:235 :30
267339 |
268340LL | const _: &str = unsafe { std::mem::transmute(B) };
269341 | ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::str::from_utf8_unchecked(B)`
270342
271- error: aborting due to 42 previous errors
343+ error: aborting due to 54 previous errors
272344
0 commit comments