mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-26 06:30:32 +00:00
184 lines
5.7 KiB
Text
184 lines
5.7 KiB
Text
error: casts from `bool` to `u8` can be expressed infallibly using `From`
|
|
--> tests/ui/cast_lossless_bool.rs:8:13
|
|
|
|
|
LL | let _ = true as u8;
|
|
| ^^^^^^^^^^
|
|
|
|
|
= help: an `as` cast can become silently lossy if the types change in the future
|
|
= note: `-D clippy::cast-lossless` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::cast_lossless)]`
|
|
help: use `u8::from` instead
|
|
|
|
|
LL | let _ = u8::from(true);
|
|
| ~~~~~~~~~~~~~~
|
|
|
|
error: casts from `bool` to `u16` can be expressed infallibly using `From`
|
|
--> tests/ui/cast_lossless_bool.rs:9:13
|
|
|
|
|
LL | let _ = true as u16;
|
|
| ^^^^^^^^^^^
|
|
|
|
|
= 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);
|
|
| ~~~~~~~~~~~~~~~
|
|
|
|
error: casts from `bool` to `u32` can be expressed infallibly using `From`
|
|
--> tests/ui/cast_lossless_bool.rs:10:13
|
|
|
|
|
LL | let _ = true as u32;
|
|
| ^^^^^^^^^^^
|
|
|
|
|
= 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);
|
|
| ~~~~~~~~~~~~~~~
|
|
|
|
error: casts from `bool` to `u64` can be expressed infallibly using `From`
|
|
--> tests/ui/cast_lossless_bool.rs:11:13
|
|
|
|
|
LL | let _ = true as u64;
|
|
| ^^^^^^^^^^^
|
|
|
|
|
= 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);
|
|
| ~~~~~~~~~~~~~~~
|
|
|
|
error: casts from `bool` to `u128` can be expressed infallibly using `From`
|
|
--> tests/ui/cast_lossless_bool.rs:12:13
|
|
|
|
|
LL | let _ = true as u128;
|
|
| ^^^^^^^^^^^^
|
|
|
|
|
= 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);
|
|
| ~~~~~~~~~~~~~~~~
|
|
|
|
error: casts from `bool` to `usize` can be expressed infallibly using `From`
|
|
--> tests/ui/cast_lossless_bool.rs:13:13
|
|
|
|
|
LL | let _ = true as usize;
|
|
| ^^^^^^^^^^^^^
|
|
|
|
|
= 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);
|
|
| ~~~~~~~~~~~~~~~~~
|
|
|
|
error: casts from `bool` to `i8` can be expressed infallibly using `From`
|
|
--> tests/ui/cast_lossless_bool.rs:15:13
|
|
|
|
|
LL | let _ = true as i8;
|
|
| ^^^^^^^^^^
|
|
|
|
|
= 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);
|
|
| ~~~~~~~~~~~~~~
|
|
|
|
error: casts from `bool` to `i16` can be expressed infallibly using `From`
|
|
--> tests/ui/cast_lossless_bool.rs:16:13
|
|
|
|
|
LL | let _ = true as i16;
|
|
| ^^^^^^^^^^^
|
|
|
|
|
= 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);
|
|
| ~~~~~~~~~~~~~~~
|
|
|
|
error: casts from `bool` to `i32` can be expressed infallibly using `From`
|
|
--> tests/ui/cast_lossless_bool.rs:17:13
|
|
|
|
|
LL | let _ = true as i32;
|
|
| ^^^^^^^^^^^
|
|
|
|
|
= 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);
|
|
| ~~~~~~~~~~~~~~~
|
|
|
|
error: casts from `bool` to `i64` can be expressed infallibly using `From`
|
|
--> tests/ui/cast_lossless_bool.rs:18:13
|
|
|
|
|
LL | let _ = true as i64;
|
|
| ^^^^^^^^^^^
|
|
|
|
|
= 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);
|
|
| ~~~~~~~~~~~~~~~
|
|
|
|
error: casts from `bool` to `i128` can be expressed infallibly using `From`
|
|
--> tests/ui/cast_lossless_bool.rs:19:13
|
|
|
|
|
LL | let _ = true as i128;
|
|
| ^^^^^^^^^^^^
|
|
|
|
|
= 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);
|
|
| ~~~~~~~~~~~~~~~~
|
|
|
|
error: casts from `bool` to `isize` can be expressed infallibly using `From`
|
|
--> tests/ui/cast_lossless_bool.rs:20:13
|
|
|
|
|
LL | let _ = true as isize;
|
|
| ^^^^^^^^^^^^^
|
|
|
|
|
= 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);
|
|
| ~~~~~~~~~~~~~~~~~
|
|
|
|
error: casts from `bool` to `u16` can be expressed infallibly using `From`
|
|
--> tests/ui/cast_lossless_bool.rs:23:13
|
|
|
|
|
LL | let _ = (true | false) as u16;
|
|
| ^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= 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);
|
|
| ~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
error: casts from `bool` to `u8` can be expressed infallibly using `From`
|
|
--> tests/ui/cast_lossless_bool.rs:25:13
|
|
|
|
|
LL | let _ = true as U8;
|
|
| ^^^^^^^^^^
|
|
|
|
|
= 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);
|
|
| ~~~~~~~~~~~~~~
|
|
|
|
error: casts from `bool` to `u8` can be expressed infallibly using `From`
|
|
--> tests/ui/cast_lossless_bool.rs:53:13
|
|
|
|
|
LL | let _ = true as u8;
|
|
| ^^^^^^^^^^
|
|
|
|
|
= 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);
|
|
| ~~~~~~~~~~~~~~
|
|
|
|
error: aborting due to 15 previous errors
|
|
|