11error: this transmute is always evaluated eagerly, even if the condition is false
2- --> $DIR/eager_transmute.rs:16 :33
2+ --> $DIR/eager_transmute.rs:21 :33
33 |
44LL | (op < 4).then_some(unsafe { std::mem::transmute(op) })
55 | ^^^^^^^^^^^^^^^^^^^^^^^
@@ -12,7 +12,7 @@ LL | (op < 4).then(|| unsafe { std::mem::transmute(op) })
1212 | ~~~~ ++
1313
1414error: this transmute is always evaluated eagerly, even if the condition is false
15- --> $DIR/eager_transmute.rs:22 :33
15+ --> $DIR/eager_transmute.rs:27 :33
1616 |
1717LL | (op < 4).then_some(unsafe { std::mem::transmute::<_, Opcode>(op) });
1818 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -23,7 +23,7 @@ LL | (op < 4).then(|| unsafe { std::mem::transmute::<_, Opcode>(op) });
2323 | ~~~~ ++
2424
2525error: this transmute is always evaluated eagerly, even if the condition is false
26- --> $DIR/eager_transmute.rs:23 :33
26+ --> $DIR/eager_transmute.rs:28 :33
2727 |
2828LL | (op > 4).then_some(unsafe { std::mem::transmute::<_, Opcode>(op) });
2929 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -34,7 +34,7 @@ LL | (op > 4).then(|| unsafe { std::mem::transmute::<_, Opcode>(op) });
3434 | ~~~~ ++
3535
3636error: this transmute is always evaluated eagerly, even if the condition is false
37- --> $DIR/eager_transmute.rs:24 :34
37+ --> $DIR/eager_transmute.rs:29 :34
3838 |
3939LL | (op == 0).then_some(unsafe { std::mem::transmute::<_, Opcode>(op) });
4040 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -45,7 +45,40 @@ LL | (op == 0).then(|| unsafe { std::mem::transmute::<_, Opcode>(op) });
4545 | ~~~~ ++
4646
4747error: this transmute is always evaluated eagerly, even if the condition is false
48- --> $DIR/eager_transmute.rs:28:24
48+ --> $DIR/eager_transmute.rs:31:68
49+ |
50+ LL | let _: Option<Opcode> = (op > 0 && op < 10).then_some(unsafe { std::mem::transmute(op) });
51+ | ^^^^^^^^^^^^^^^^^^^^^^^
52+ |
53+ help: consider using `bool::then` to only transmute if the condition holds
54+ |
55+ LL | let _: Option<Opcode> = (op > 0 && op < 10).then(|| unsafe { std::mem::transmute(op) });
56+ | ~~~~ ++
57+
58+ error: this transmute is always evaluated eagerly, even if the condition is false
59+ --> $DIR/eager_transmute.rs:32:86
60+ |
61+ LL | let _: Option<Opcode> = (op > 0 && op < 10 && unrelated == 0).then_some(unsafe { std::mem::transmute(op) });
62+ | ^^^^^^^^^^^^^^^^^^^^^^^
63+ |
64+ help: consider using `bool::then` to only transmute if the condition holds
65+ |
66+ LL | let _: Option<Opcode> = (op > 0 && op < 10 && unrelated == 0).then(|| unsafe { std::mem::transmute(op) });
67+ | ~~~~ ++
68+
69+ error: this transmute is always evaluated eagerly, even if the condition is false
70+ --> $DIR/eager_transmute.rs:35:84
71+ |
72+ LL | let _: Option<Opcode> = (op2.foo[0] > 0 && op2.foo[0] < 10).then_some(unsafe { std::mem::transmute(op2.foo[0]) });
73+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
74+ |
75+ help: consider using `bool::then` to only transmute if the condition holds
76+ |
77+ LL | let _: Option<Opcode> = (op2.foo[0] > 0 && op2.foo[0] < 10).then(|| unsafe { std::mem::transmute(op2.foo[0]) });
78+ | ~~~~ ++
79+
80+ error: this transmute is always evaluated eagerly, even if the condition is false
81+ --> $DIR/eager_transmute.rs:48:24
4982 |
5083LL | (op < 4).then_some(std::mem::transmute::<_, Opcode>(op));
5184 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -56,7 +89,7 @@ LL | (op < 4).then(|| std::mem::transmute::<_, Opcode>(op));
5689 | ~~~~ ++
5790
5891error: this transmute is always evaluated eagerly, even if the condition is false
59- --> $DIR/eager_transmute.rs:57 :60
92+ --> $DIR/eager_transmute.rs:77 :60
6093 |
6194LL | let _: Option<NonZeroU8> = (v1 > 0).then_some(unsafe { std::mem::transmute(v1) });
6295 | ^^^^^^^^^^^^^^^^^^^^^^^
@@ -67,7 +100,7 @@ LL | let _: Option<NonZeroU8> = (v1 > 0).then(|| unsafe { std::mem::transmut
67100 | ~~~~ ++
68101
69102error: this transmute is always evaluated eagerly, even if the condition is false
70- --> $DIR/eager_transmute.rs:63 :86
103+ --> $DIR/eager_transmute.rs:83 :86
71104 |
72105LL | let _: Option<NonMaxU8> = (v2 < NonZeroU8::new(255).unwrap()).then_some(unsafe { std::mem::transmute(v2) });
73106 | ^^^^^^^^^^^^^^^^^^^^^^^
@@ -78,7 +111,7 @@ LL | let _: Option<NonMaxU8> = (v2 < NonZeroU8::new(255).unwrap()).then(|| u
78111 | ~~~~ ++
79112
80113error: this transmute is always evaluated eagerly, even if the condition is false
81- --> $DIR/eager_transmute.rs:69 :93
114+ --> $DIR/eager_transmute.rs:89 :93
82115 |
83116LL | let _: Option<NonZeroNonMaxU8> = (v2 < NonZeroU8::new(255).unwrap()).then_some(unsafe { std::mem::transmute(v2) });
84117 | ^^^^^^^^^^^^^^^^^^^^^^^
@@ -88,5 +121,5 @@ help: consider using `bool::then` to only transmute if the condition holds
88121LL | let _: Option<NonZeroNonMaxU8> = (v2 < NonZeroU8::new(255).unwrap()).then(|| unsafe { std::mem::transmute(v2) });
89122 | ~~~~ ++
90123
91- error: aborting due to 8 previous errors
124+ error: aborting due to 11 previous errors
92125
0 commit comments