2019-12-08 00:59:17 +00:00
|
|
|
error: transmute from a `f32` to a `u32`
|
2024-06-18 17:34:49 +00:00
|
|
|
--> tests/ui/transmute_float_to_int.rs:7:27
|
2019-12-08 00:59:17 +00:00
|
|
|
|
|
|
|
|
LL | let _: u32 = unsafe { std::mem::transmute(1f32) };
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `1f32.to_bits()`
|
|
|
|
|
|
|
|
|
= note: `-D clippy::transmute-float-to-int` implied by `-D warnings`
|
2023-08-01 12:02:21 +00:00
|
|
|
= help: to override `-D warnings` add `#[allow(clippy::transmute_float_to_int)]`
|
2019-12-08 00:59:17 +00:00
|
|
|
|
|
|
|
error: transmute from a `f32` to a `i32`
|
2024-06-18 17:34:49 +00:00
|
|
|
--> tests/ui/transmute_float_to_int.rs:10:27
|
2019-12-08 00:59:17 +00:00
|
|
|
|
|
|
|
|
LL | let _: i32 = unsafe { std::mem::transmute(1f32) };
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `1f32.to_bits() as i32`
|
|
|
|
|
|
|
|
error: transmute from a `f64` to a `u64`
|
2024-06-18 17:34:49 +00:00
|
|
|
--> tests/ui/transmute_float_to_int.rs:12:27
|
2019-12-08 00:59:17 +00:00
|
|
|
|
|
|
|
|
LL | let _: u64 = unsafe { std::mem::transmute(1f64) };
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `1f64.to_bits()`
|
|
|
|
|
|
|
|
error: transmute from a `f64` to a `i64`
|
2024-06-18 17:34:49 +00:00
|
|
|
--> tests/ui/transmute_float_to_int.rs:14:27
|
2019-12-08 00:59:17 +00:00
|
|
|
|
|
|
|
|
LL | let _: i64 = unsafe { std::mem::transmute(1f64) };
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `1f64.to_bits() as i64`
|
|
|
|
|
|
|
|
error: transmute from a `f64` to a `u64`
|
2024-06-18 17:34:49 +00:00
|
|
|
--> tests/ui/transmute_float_to_int.rs:16:27
|
2019-12-08 00:59:17 +00:00
|
|
|
|
|
|
|
|
LL | let _: u64 = unsafe { std::mem::transmute(1.0) };
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `1.0f64.to_bits()`
|
|
|
|
|
|
|
|
error: transmute from a `f64` to a `u64`
|
2024-06-18 17:34:49 +00:00
|
|
|
--> tests/ui/transmute_float_to_int.rs:18:27
|
2019-12-08 00:59:17 +00:00
|
|
|
|
|
|
|
|
LL | let _: u64 = unsafe { std::mem::transmute(-1.0) };
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(-1.0f64).to_bits()`
|
|
|
|
|
2024-08-25 13:15:15 +00:00
|
|
|
error: transmute from a `f16` to a `i16`
|
|
|
|
--> tests/ui/transmute_float_to_int.rs:23:35
|
|
|
|
|
|
|
|
|
LL | const VALUE16: i16 = unsafe { std::mem::transmute(1f16) };
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `1f16.to_bits() as i16`
|
|
|
|
|
|
|
|
error: transmute from a `f32` to a `i32`
|
|
|
|
--> tests/ui/transmute_float_to_int.rs:25:35
|
|
|
|
|
|
|
|
|
LL | const VALUE32: i32 = unsafe { std::mem::transmute(1f32) };
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `1f32.to_bits() as i32`
|
|
|
|
|
|
|
|
error: transmute from a `f64` to a `u64`
|
|
|
|
--> tests/ui/transmute_float_to_int.rs:27:35
|
|
|
|
|
|
|
|
|
LL | const VALUE64: u64 = unsafe { std::mem::transmute(1f64) };
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `1f64.to_bits()`
|
|
|
|
|
|
|
|
error: transmute from a `f128` to a `u128`
|
|
|
|
--> tests/ui/transmute_float_to_int.rs:29:37
|
|
|
|
|
|
|
|
|
LL | const VALUE128: u128 = unsafe { std::mem::transmute(1f128) };
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `1f128.to_bits()`
|
|
|
|
|
|
|
|
error: transmute from a `f16` to a `u16`
|
|
|
|
--> tests/ui/transmute_float_to_int.rs:33:18
|
|
|
|
|
|
|
|
|
LL | unsafe { std::mem::transmute(v) }
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `v.to_bits()`
|
|
|
|
|
|
|
|
error: transmute from a `f32` to a `u32`
|
|
|
|
--> tests/ui/transmute_float_to_int.rs:38:18
|
|
|
|
|
|
|
|
|
LL | unsafe { std::mem::transmute(v) }
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `v.to_bits()`
|
|
|
|
|
|
|
|
error: transmute from a `f64` to a `i64`
|
|
|
|
--> tests/ui/transmute_float_to_int.rs:43:18
|
|
|
|
|
|
|
|
|
LL | unsafe { std::mem::transmute(v) }
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `v.to_bits() as i64`
|
|
|
|
|
|
|
|
error: transmute from a `f128` to a `i128`
|
|
|
|
--> tests/ui/transmute_float_to_int.rs:48:18
|
|
|
|
|
|
|
|
|
LL | unsafe { std::mem::transmute(v) }
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `v.to_bits() as i128`
|
|
|
|
|
|
|
|
error: aborting due to 14 previous errors
|
2019-12-08 00:59:17 +00:00
|
|
|
|