mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 15:11:30 +00:00
64 lines
3 KiB
Text
64 lines
3 KiB
Text
error: transmute from a `u8` to a `NonZeroU8`
|
|
--> $DIR/transmute_int_to_non_zero.rs:18:33
|
|
|
|
|
LL | let _: NonZeroU8 = unsafe { std::mem::transmute(int_u8) };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `NonZeroU8::new_unchecked(int_u8)`
|
|
|
|
|
= note: `-D clippy::transmute-int-to-non-zero` implied by `-D warnings`
|
|
|
|
error: transmute from a `u16` to a `NonZeroU16`
|
|
--> $DIR/transmute_int_to_non_zero.rs:19:34
|
|
|
|
|
LL | let _: NonZeroU16 = unsafe { std::mem::transmute(int_u16) };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `NonZeroU16::new_unchecked(int_u16)`
|
|
|
|
error: transmute from a `u32` to a `NonZeroU32`
|
|
--> $DIR/transmute_int_to_non_zero.rs:20:34
|
|
|
|
|
LL | let _: NonZeroU32 = unsafe { std::mem::transmute(int_u32) };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `NonZeroU32::new_unchecked(int_u32)`
|
|
|
|
error: transmute from a `u64` to a `NonZeroU64`
|
|
--> $DIR/transmute_int_to_non_zero.rs:21:34
|
|
|
|
|
LL | let _: NonZeroU64 = unsafe { std::mem::transmute(int_u64) };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `NonZeroU64::new_unchecked(int_u64)`
|
|
|
|
error: transmute from a `u128` to a `NonZeroU128`
|
|
--> $DIR/transmute_int_to_non_zero.rs:22:35
|
|
|
|
|
LL | let _: NonZeroU128 = unsafe { std::mem::transmute(int_u128) };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `NonZeroU128::new_unchecked(int_u128)`
|
|
|
|
error: transmute from a `i8` to a `NonZeroI8`
|
|
--> $DIR/transmute_int_to_non_zero.rs:24:33
|
|
|
|
|
LL | let _: NonZeroI8 = unsafe { std::mem::transmute(int_i8) };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `NonZeroI8::new_unchecked(int_i8)`
|
|
|
|
error: transmute from a `i16` to a `NonZeroI16`
|
|
--> $DIR/transmute_int_to_non_zero.rs:25:34
|
|
|
|
|
LL | let _: NonZeroI16 = unsafe { std::mem::transmute(int_i16) };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `NonZeroI16::new_unchecked(int_i16)`
|
|
|
|
error: transmute from a `i32` to a `NonZeroI32`
|
|
--> $DIR/transmute_int_to_non_zero.rs:26:34
|
|
|
|
|
LL | let _: NonZeroI32 = unsafe { std::mem::transmute(int_i32) };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `NonZeroI32::new_unchecked(int_i32)`
|
|
|
|
error: transmute from a `i64` to a `NonZeroI64`
|
|
--> $DIR/transmute_int_to_non_zero.rs:27:34
|
|
|
|
|
LL | let _: NonZeroI64 = unsafe { std::mem::transmute(int_i64) };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `NonZeroI64::new_unchecked(int_i64)`
|
|
|
|
error: transmute from a `i128` to a `NonZeroI128`
|
|
--> $DIR/transmute_int_to_non_zero.rs:28:35
|
|
|
|
|
LL | let _: NonZeroI128 = unsafe { std::mem::transmute(int_i128) };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `NonZeroI128::new_unchecked(int_i128)`
|
|
|
|
error: aborting due to 10 previous errors
|
|
|