2023-12-28 12:33:07 -06:00
|
|
|
error: this transmute is always evaluated eagerly, even if the condition is false
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/eager_transmute.rs:21:33
|
2023-12-28 12:33:07 -06:00
|
|
|
|
|
|
|
|
LL | (op < 4).then_some(unsafe { std::mem::transmute(op) })
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= note: `-D clippy::eager-transmute` implied by `-D warnings`
|
|
|
|
= help: to override `-D warnings` add `#[allow(clippy::eager_transmute)]`
|
|
|
|
help: consider using `bool::then` to only transmute if the condition holds
|
|
|
|
|
|
|
|
|
LL | (op < 4).then(|| unsafe { std::mem::transmute(op) })
|
|
|
|
| ~~~~ ++
|
|
|
|
|
|
|
|
error: this transmute is always evaluated eagerly, even if the condition is false
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/eager_transmute.rs:27:33
|
2023-12-28 12:33:07 -06:00
|
|
|
|
|
|
|
|
LL | (op < 4).then_some(unsafe { std::mem::transmute::<_, Opcode>(op) });
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
help: consider using `bool::then` to only transmute if the condition holds
|
|
|
|
|
|
|
|
|
LL | (op < 4).then(|| unsafe { std::mem::transmute::<_, Opcode>(op) });
|
|
|
|
| ~~~~ ++
|
|
|
|
|
|
|
|
error: this transmute is always evaluated eagerly, even if the condition is false
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/eager_transmute.rs:28:33
|
2023-12-28 12:33:07 -06:00
|
|
|
|
|
|
|
|
LL | (op > 4).then_some(unsafe { std::mem::transmute::<_, Opcode>(op) });
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
help: consider using `bool::then` to only transmute if the condition holds
|
|
|
|
|
|
|
|
|
LL | (op > 4).then(|| unsafe { std::mem::transmute::<_, Opcode>(op) });
|
|
|
|
| ~~~~ ++
|
|
|
|
|
|
|
|
error: this transmute is always evaluated eagerly, even if the condition is false
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/eager_transmute.rs:29:34
|
2023-12-28 12:33:07 -06:00
|
|
|
|
|
|
|
|
LL | (op == 0).then_some(unsafe { std::mem::transmute::<_, Opcode>(op) });
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
help: consider using `bool::then` to only transmute if the condition holds
|
|
|
|
|
|
|
|
|
LL | (op == 0).then(|| unsafe { std::mem::transmute::<_, Opcode>(op) });
|
|
|
|
| ~~~~ ++
|
|
|
|
|
|
|
|
error: this transmute is always evaluated eagerly, even if the condition is false
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/eager_transmute.rs:31:68
|
2024-01-11 10:27:03 -06:00
|
|
|
|
|
|
|
|
LL | let _: Option<Opcode> = (op > 0 && op < 10).then_some(unsafe { std::mem::transmute(op) });
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
help: consider using `bool::then` to only transmute if the condition holds
|
|
|
|
|
|
|
|
|
LL | let _: Option<Opcode> = (op > 0 && op < 10).then(|| unsafe { std::mem::transmute(op) });
|
|
|
|
| ~~~~ ++
|
|
|
|
|
|
|
|
error: this transmute is always evaluated eagerly, even if the condition is false
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/eager_transmute.rs:32:86
|
2024-01-11 10:27:03 -06:00
|
|
|
|
|
|
|
|
LL | let _: Option<Opcode> = (op > 0 && op < 10 && unrelated == 0).then_some(unsafe { std::mem::transmute(op) });
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
help: consider using `bool::then` to only transmute if the condition holds
|
|
|
|
|
|
|
|
|
LL | let _: Option<Opcode> = (op > 0 && op < 10 && unrelated == 0).then(|| unsafe { std::mem::transmute(op) });
|
|
|
|
| ~~~~ ++
|
|
|
|
|
|
|
|
error: this transmute is always evaluated eagerly, even if the condition is false
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/eager_transmute.rs:35:84
|
2024-01-11 10:27:03 -06:00
|
|
|
|
|
|
|
|
LL | let _: Option<Opcode> = (op2.foo[0] > 0 && op2.foo[0] < 10).then_some(unsafe { std::mem::transmute(op2.foo[0]) });
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
help: consider using `bool::then` to only transmute if the condition holds
|
|
|
|
|
|
|
|
|
LL | let _: Option<Opcode> = (op2.foo[0] > 0 && op2.foo[0] < 10).then(|| unsafe { std::mem::transmute(op2.foo[0]) });
|
|
|
|
| ~~~~ ++
|
|
|
|
|
|
|
|
error: this transmute is always evaluated eagerly, even if the condition is false
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/eager_transmute.rs:47:70
|
2024-01-11 10:27:03 -06:00
|
|
|
|
|
|
|
|
LL | let _: Option<Opcode> = (1..=3).contains(&op).then_some(unsafe { std::mem::transmute(op) });
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
help: consider using `bool::then` to only transmute if the condition holds
|
|
|
|
|
|
|
|
|
LL | let _: Option<Opcode> = (1..=3).contains(&op).then(|| unsafe { std::mem::transmute(op) });
|
|
|
|
| ~~~~ ++
|
|
|
|
|
|
|
|
error: this transmute is always evaluated eagerly, even if the condition is false
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/eager_transmute.rs:48:83
|
2024-01-11 10:27:03 -06:00
|
|
|
|
|
|
|
|
LL | let _: Option<Opcode> = ((1..=3).contains(&op) || op == 4).then_some(unsafe { std::mem::transmute(op) });
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
help: consider using `bool::then` to only transmute if the condition holds
|
|
|
|
|
|
|
|
|
LL | let _: Option<Opcode> = ((1..=3).contains(&op) || op == 4).then(|| unsafe { std::mem::transmute(op) });
|
|
|
|
| ~~~~ ++
|
|
|
|
|
|
|
|
error: this transmute is always evaluated eagerly, even if the condition is false
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/eager_transmute.rs:49:69
|
2024-01-11 10:27:03 -06:00
|
|
|
|
|
|
|
|
LL | let _: Option<Opcode> = (1..3).contains(&op).then_some(unsafe { std::mem::transmute(op) });
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
help: consider using `bool::then` to only transmute if the condition holds
|
|
|
|
|
|
|
|
|
LL | let _: Option<Opcode> = (1..3).contains(&op).then(|| unsafe { std::mem::transmute(op) });
|
|
|
|
| ~~~~ ++
|
|
|
|
|
|
|
|
error: this transmute is always evaluated eagerly, even if the condition is false
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/eager_transmute.rs:50:68
|
2024-01-11 10:27:03 -06:00
|
|
|
|
|
|
|
|
LL | let _: Option<Opcode> = (1..).contains(&op).then_some(unsafe { std::mem::transmute(op) });
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
help: consider using `bool::then` to only transmute if the condition holds
|
|
|
|
|
|
|
|
|
LL | let _: Option<Opcode> = (1..).contains(&op).then(|| unsafe { std::mem::transmute(op) });
|
|
|
|
| ~~~~ ++
|
|
|
|
|
|
|
|
error: this transmute is always evaluated eagerly, even if the condition is false
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/eager_transmute.rs:51:68
|
2024-01-11 10:27:03 -06:00
|
|
|
|
|
|
|
|
LL | let _: Option<Opcode> = (..3).contains(&op).then_some(unsafe { std::mem::transmute(op) });
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
help: consider using `bool::then` to only transmute if the condition holds
|
|
|
|
|
|
|
|
|
LL | let _: Option<Opcode> = (..3).contains(&op).then(|| unsafe { std::mem::transmute(op) });
|
|
|
|
| ~~~~ ++
|
|
|
|
|
|
|
|
error: this transmute is always evaluated eagerly, even if the condition is false
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/eager_transmute.rs:52:69
|
2024-01-11 10:27:03 -06:00
|
|
|
|
|
|
|
|
LL | let _: Option<Opcode> = (..=3).contains(&op).then_some(unsafe { std::mem::transmute(op) });
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
help: consider using `bool::then` to only transmute if the condition holds
|
|
|
|
|
|
|
|
|
LL | let _: Option<Opcode> = (..=3).contains(&op).then(|| unsafe { std::mem::transmute(op) });
|
|
|
|
| ~~~~ ++
|
|
|
|
|
|
|
|
error: this transmute is always evaluated eagerly, even if the condition is false
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/eager_transmute.rs:61:24
|
2023-12-28 12:33:07 -06:00
|
|
|
|
|
|
|
|
LL | (op < 4).then_some(std::mem::transmute::<_, Opcode>(op));
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
help: consider using `bool::then` to only transmute if the condition holds
|
|
|
|
|
|
|
|
|
LL | (op < 4).then(|| std::mem::transmute::<_, Opcode>(op));
|
|
|
|
| ~~~~ ++
|
|
|
|
|
|
|
|
error: this transmute is always evaluated eagerly, even if the condition is false
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/eager_transmute.rs:90:60
|
2023-12-28 12:33:07 -06:00
|
|
|
|
|
|
|
|
LL | let _: Option<NonZeroU8> = (v1 > 0).then_some(unsafe { std::mem::transmute(v1) });
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
help: consider using `bool::then` to only transmute if the condition holds
|
|
|
|
|
|
|
|
|
LL | let _: Option<NonZeroU8> = (v1 > 0).then(|| unsafe { std::mem::transmute(v1) });
|
|
|
|
| ~~~~ ++
|
|
|
|
|
|
|
|
error: this transmute is always evaluated eagerly, even if the condition is false
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/eager_transmute.rs:96:86
|
2023-12-28 12:33:07 -06:00
|
|
|
|
|
|
|
|
LL | let _: Option<NonMaxU8> = (v2 < NonZeroU8::new(255).unwrap()).then_some(unsafe { std::mem::transmute(v2) });
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
help: consider using `bool::then` to only transmute if the condition holds
|
|
|
|
|
|
|
|
|
LL | let _: Option<NonMaxU8> = (v2 < NonZeroU8::new(255).unwrap()).then(|| unsafe { std::mem::transmute(v2) });
|
|
|
|
| ~~~~ ++
|
|
|
|
|
|
|
|
error: this transmute is always evaluated eagerly, even if the condition is false
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/eager_transmute.rs:102:93
|
2023-12-28 12:33:07 -06:00
|
|
|
|
|
|
|
|
LL | let _: Option<NonZeroNonMaxU8> = (v2 < NonZeroU8::new(255).unwrap()).then_some(unsafe { std::mem::transmute(v2) });
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
help: consider using `bool::then` to only transmute if the condition holds
|
|
|
|
|
|
|
|
|
LL | let _: Option<NonZeroNonMaxU8> = (v2 < NonZeroU8::new(255).unwrap()).then(|| unsafe { std::mem::transmute(v2) });
|
|
|
|
| ~~~~ ++
|
|
|
|
|
2024-01-11 10:27:03 -06:00
|
|
|
error: aborting due to 17 previous errors
|
2023-12-28 12:33:07 -06:00
|
|
|
|