2024-07-22 19:00:58 +00:00
|
|
|
error: casts from `bool` to `u8` can be expressed infallibly using `From`
|
2023-08-02 19:36:25 +00:00
|
|
|
--> tests/ui/cast_lossless_bool.rs:8:13
|
2021-12-06 11:33:31 +00:00
|
|
|
|
|
|
|
|
LL | let _ = true as u8;
|
2024-07-22 19:00:58 +00:00
|
|
|
| ^^^^^^^^^^
|
2021-12-06 11:33:31 +00:00
|
|
|
|
|
2024-07-22 19:00:58 +00:00
|
|
|
= help: an `as` cast can become silently lossy if the types change in the future
|
2021-12-06 11:33:31 +00:00
|
|
|
= note: `-D clippy::cast-lossless` implied by `-D warnings`
|
2023-08-01 12:02:21 +00:00
|
|
|
= help: to override `-D warnings` add `#[allow(clippy::cast_lossless)]`
|
2024-07-22 19:00:58 +00:00
|
|
|
help: use `u8::from` instead
|
|
|
|
|
|
|
|
|
LL | let _ = u8::from(true);
|
|
|
|
| ~~~~~~~~~~~~~~
|
2021-12-06 11:33:31 +00:00
|
|
|
|
2024-07-22 19:00:58 +00:00
|
|
|
error: casts from `bool` to `u16` can be expressed infallibly using `From`
|
2023-08-02 19:36:25 +00:00
|
|
|
--> tests/ui/cast_lossless_bool.rs:9:13
|
2021-12-06 11:33:31 +00:00
|
|
|
|
|
|
|
|
LL | let _ = true as u16;
|
2024-07-22 19:00:58 +00:00
|
|
|
| ^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= help: an `as` cast can become silently lossy if the types change in the future
|
|
|
|
help: use `u16::from` instead
|
|
|
|
|
|
|
|
|
LL | let _ = u16::from(true);
|
|
|
|
| ~~~~~~~~~~~~~~~
|
2021-12-06 11:33:31 +00:00
|
|
|
|
2024-07-22 19:00:58 +00:00
|
|
|
error: casts from `bool` to `u32` can be expressed infallibly using `From`
|
2023-08-02 19:36:25 +00:00
|
|
|
--> tests/ui/cast_lossless_bool.rs:10:13
|
2021-12-06 11:33:31 +00:00
|
|
|
|
|
|
|
|
LL | let _ = true as u32;
|
2024-07-22 19:00:58 +00:00
|
|
|
| ^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= help: an `as` cast can become silently lossy if the types change in the future
|
|
|
|
help: use `u32::from` instead
|
|
|
|
|
|
|
|
|
LL | let _ = u32::from(true);
|
|
|
|
| ~~~~~~~~~~~~~~~
|
2021-12-06 11:33:31 +00:00
|
|
|
|
2024-07-22 19:00:58 +00:00
|
|
|
error: casts from `bool` to `u64` can be expressed infallibly using `From`
|
2023-08-02 19:36:25 +00:00
|
|
|
--> tests/ui/cast_lossless_bool.rs:11:13
|
2021-12-06 11:33:31 +00:00
|
|
|
|
|
|
|
|
LL | let _ = true as u64;
|
2024-07-22 19:00:58 +00:00
|
|
|
| ^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= help: an `as` cast can become silently lossy if the types change in the future
|
|
|
|
help: use `u64::from` instead
|
|
|
|
|
|
|
|
|
LL | let _ = u64::from(true);
|
|
|
|
| ~~~~~~~~~~~~~~~
|
2021-12-06 11:33:31 +00:00
|
|
|
|
2024-07-22 19:00:58 +00:00
|
|
|
error: casts from `bool` to `u128` can be expressed infallibly using `From`
|
2023-08-02 19:36:25 +00:00
|
|
|
--> tests/ui/cast_lossless_bool.rs:12:13
|
2021-12-06 11:33:31 +00:00
|
|
|
|
|
|
|
|
LL | let _ = true as u128;
|
2024-07-22 19:00:58 +00:00
|
|
|
| ^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= help: an `as` cast can become silently lossy if the types change in the future
|
|
|
|
help: use `u128::from` instead
|
|
|
|
|
|
|
|
|
LL | let _ = u128::from(true);
|
|
|
|
| ~~~~~~~~~~~~~~~~
|
2021-12-06 11:33:31 +00:00
|
|
|
|
2024-07-22 19:00:58 +00:00
|
|
|
error: casts from `bool` to `usize` can be expressed infallibly using `From`
|
2023-08-02 19:36:25 +00:00
|
|
|
--> tests/ui/cast_lossless_bool.rs:13:13
|
2021-12-06 11:33:31 +00:00
|
|
|
|
|
|
|
|
LL | let _ = true as usize;
|
2024-07-22 19:00:58 +00:00
|
|
|
| ^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= help: an `as` cast can become silently lossy if the types change in the future
|
|
|
|
help: use `usize::from` instead
|
|
|
|
|
|
|
|
|
LL | let _ = usize::from(true);
|
|
|
|
| ~~~~~~~~~~~~~~~~~
|
2021-12-06 11:33:31 +00:00
|
|
|
|
2024-07-22 19:00:58 +00:00
|
|
|
error: casts from `bool` to `i8` can be expressed infallibly using `From`
|
2023-08-02 19:36:25 +00:00
|
|
|
--> tests/ui/cast_lossless_bool.rs:15:13
|
2021-12-06 11:33:31 +00:00
|
|
|
|
|
|
|
|
LL | let _ = true as i8;
|
2024-07-22 19:00:58 +00:00
|
|
|
| ^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= help: an `as` cast can become silently lossy if the types change in the future
|
|
|
|
help: use `i8::from` instead
|
|
|
|
|
|
|
|
|
LL | let _ = i8::from(true);
|
|
|
|
| ~~~~~~~~~~~~~~
|
2021-12-06 11:33:31 +00:00
|
|
|
|
2024-07-22 19:00:58 +00:00
|
|
|
error: casts from `bool` to `i16` can be expressed infallibly using `From`
|
2023-08-02 19:36:25 +00:00
|
|
|
--> tests/ui/cast_lossless_bool.rs:16:13
|
2021-12-06 11:33:31 +00:00
|
|
|
|
|
|
|
|
LL | let _ = true as i16;
|
2024-07-22 19:00:58 +00:00
|
|
|
| ^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= help: an `as` cast can become silently lossy if the types change in the future
|
|
|
|
help: use `i16::from` instead
|
|
|
|
|
|
|
|
|
LL | let _ = i16::from(true);
|
|
|
|
| ~~~~~~~~~~~~~~~
|
2021-12-06 11:33:31 +00:00
|
|
|
|
2024-07-22 19:00:58 +00:00
|
|
|
error: casts from `bool` to `i32` can be expressed infallibly using `From`
|
2023-08-02 19:36:25 +00:00
|
|
|
--> tests/ui/cast_lossless_bool.rs:17:13
|
2021-12-06 11:33:31 +00:00
|
|
|
|
|
|
|
|
LL | let _ = true as i32;
|
2024-07-22 19:00:58 +00:00
|
|
|
| ^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= help: an `as` cast can become silently lossy if the types change in the future
|
|
|
|
help: use `i32::from` instead
|
|
|
|
|
|
|
|
|
LL | let _ = i32::from(true);
|
|
|
|
| ~~~~~~~~~~~~~~~
|
2021-12-06 11:33:31 +00:00
|
|
|
|
2024-07-22 19:00:58 +00:00
|
|
|
error: casts from `bool` to `i64` can be expressed infallibly using `From`
|
2023-08-02 19:36:25 +00:00
|
|
|
--> tests/ui/cast_lossless_bool.rs:18:13
|
2021-12-06 11:33:31 +00:00
|
|
|
|
|
|
|
|
LL | let _ = true as i64;
|
2024-07-22 19:00:58 +00:00
|
|
|
| ^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= help: an `as` cast can become silently lossy if the types change in the future
|
|
|
|
help: use `i64::from` instead
|
|
|
|
|
|
|
|
|
LL | let _ = i64::from(true);
|
|
|
|
| ~~~~~~~~~~~~~~~
|
2021-12-06 11:33:31 +00:00
|
|
|
|
2024-07-22 19:00:58 +00:00
|
|
|
error: casts from `bool` to `i128` can be expressed infallibly using `From`
|
2023-08-02 19:36:25 +00:00
|
|
|
--> tests/ui/cast_lossless_bool.rs:19:13
|
2021-12-06 11:33:31 +00:00
|
|
|
|
|
|
|
|
LL | let _ = true as i128;
|
2024-07-22 19:00:58 +00:00
|
|
|
| ^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= help: an `as` cast can become silently lossy if the types change in the future
|
|
|
|
help: use `i128::from` instead
|
|
|
|
|
|
|
|
|
LL | let _ = i128::from(true);
|
|
|
|
| ~~~~~~~~~~~~~~~~
|
2021-12-06 11:33:31 +00:00
|
|
|
|
2024-07-22 19:00:58 +00:00
|
|
|
error: casts from `bool` to `isize` can be expressed infallibly using `From`
|
2023-08-02 19:36:25 +00:00
|
|
|
--> tests/ui/cast_lossless_bool.rs:20:13
|
2021-12-06 11:33:31 +00:00
|
|
|
|
|
|
|
|
LL | let _ = true as isize;
|
2024-07-22 19:00:58 +00:00
|
|
|
| ^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= help: an `as` cast can become silently lossy if the types change in the future
|
|
|
|
help: use `isize::from` instead
|
|
|
|
|
|
|
|
|
LL | let _ = isize::from(true);
|
|
|
|
| ~~~~~~~~~~~~~~~~~
|
2021-12-06 11:33:31 +00:00
|
|
|
|
2024-07-22 19:00:58 +00:00
|
|
|
error: casts from `bool` to `u16` can be expressed infallibly using `From`
|
2023-08-02 19:36:25 +00:00
|
|
|
--> tests/ui/cast_lossless_bool.rs:23:13
|
2021-12-06 11:33:31 +00:00
|
|
|
|
|
|
|
|
LL | let _ = (true | false) as u16;
|
2024-07-22 19:00:58 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= help: an `as` cast can become silently lossy if the types change in the future
|
|
|
|
help: use `u16::from` instead
|
|
|
|
|
|
|
|
|
LL | let _ = u16::from(true | false);
|
|
|
|
| ~~~~~~~~~~~~~~~~~~~~~~~
|
2021-12-06 11:33:31 +00:00
|
|
|
|
2024-07-22 19:00:58 +00:00
|
|
|
error: casts from `bool` to `u8` can be expressed infallibly using `From`
|
2023-08-02 19:36:25 +00:00
|
|
|
--> tests/ui/cast_lossless_bool.rs:25:13
|
|
|
|
|
|
|
|
|
LL | let _ = true as U8;
|
2024-07-22 19:00:58 +00:00
|
|
|
| ^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= help: an `as` cast can become silently lossy if the types change in the future
|
|
|
|
help: use `U8::from` instead
|
|
|
|
|
|
|
|
|
LL | let _ = U8::from(true);
|
|
|
|
| ~~~~~~~~~~~~~~
|
2023-08-02 19:36:25 +00:00
|
|
|
|
2024-07-22 19:00:58 +00:00
|
|
|
error: casts from `bool` to `u8` can be expressed infallibly using `From`
|
2023-08-02 19:36:25 +00:00
|
|
|
--> tests/ui/cast_lossless_bool.rs:53:13
|
2022-10-23 13:18:45 +00:00
|
|
|
|
|
|
|
|
LL | let _ = true as u8;
|
2024-07-22 19:00:58 +00:00
|
|
|
| ^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= help: an `as` cast can become silently lossy if the types change in the future
|
|
|
|
help: use `u8::from` instead
|
|
|
|
|
|
|
|
|
LL | let _ = u8::from(true);
|
|
|
|
| ~~~~~~~~~~~~~~
|
2022-10-23 13:18:45 +00:00
|
|
|
|
2023-08-02 19:36:25 +00:00
|
|
|
error: aborting due to 15 previous errors
|
2021-12-06 11:33:31 +00:00
|
|
|
|