@@ -78,7 +78,73 @@ LL | let _: Option<Opcode> = (op2.foo[0] > 0 && op2.foo[0] < 10).then(|| uns
78
78
| ~~~~ ++
79
79
80
80
error: this transmute is always evaluated eagerly, even if the condition is false
81
- --> $DIR/eager_transmute.rs:48:24
81
+ --> $DIR/eager_transmute.rs:47:70
82
+ |
83
+ LL | let _: Option<Opcode> = (1..=3).contains(&op).then_some(unsafe { std::mem::transmute(op) });
84
+ | ^^^^^^^^^^^^^^^^^^^^^^^
85
+ |
86
+ help: consider using `bool::then` to only transmute if the condition holds
87
+ |
88
+ LL | let _: Option<Opcode> = (1..=3).contains(&op).then(|| unsafe { std::mem::transmute(op) });
89
+ | ~~~~ ++
90
+
91
+ error: this transmute is always evaluated eagerly, even if the condition is false
92
+ --> $DIR/eager_transmute.rs:48:83
93
+ |
94
+ LL | let _: Option<Opcode> = ((1..=3).contains(&op) || op == 4).then_some(unsafe { std::mem::transmute(op) });
95
+ | ^^^^^^^^^^^^^^^^^^^^^^^
96
+ |
97
+ help: consider using `bool::then` to only transmute if the condition holds
98
+ |
99
+ LL | let _: Option<Opcode> = ((1..=3).contains(&op) || op == 4).then(|| unsafe { std::mem::transmute(op) });
100
+ | ~~~~ ++
101
+
102
+ error: this transmute is always evaluated eagerly, even if the condition is false
103
+ --> $DIR/eager_transmute.rs:49:69
104
+ |
105
+ LL | let _: Option<Opcode> = (1..3).contains(&op).then_some(unsafe { std::mem::transmute(op) });
106
+ | ^^^^^^^^^^^^^^^^^^^^^^^
107
+ |
108
+ help: consider using `bool::then` to only transmute if the condition holds
109
+ |
110
+ LL | let _: Option<Opcode> = (1..3).contains(&op).then(|| unsafe { std::mem::transmute(op) });
111
+ | ~~~~ ++
112
+
113
+ error: this transmute is always evaluated eagerly, even if the condition is false
114
+ --> $DIR/eager_transmute.rs:50:68
115
+ |
116
+ LL | let _: Option<Opcode> = (1..).contains(&op).then_some(unsafe { std::mem::transmute(op) });
117
+ | ^^^^^^^^^^^^^^^^^^^^^^^
118
+ |
119
+ help: consider using `bool::then` to only transmute if the condition holds
120
+ |
121
+ LL | let _: Option<Opcode> = (1..).contains(&op).then(|| unsafe { std::mem::transmute(op) });
122
+ | ~~~~ ++
123
+
124
+ error: this transmute is always evaluated eagerly, even if the condition is false
125
+ --> $DIR/eager_transmute.rs:51:68
126
+ |
127
+ LL | let _: Option<Opcode> = (..3).contains(&op).then_some(unsafe { std::mem::transmute(op) });
128
+ | ^^^^^^^^^^^^^^^^^^^^^^^
129
+ |
130
+ help: consider using `bool::then` to only transmute if the condition holds
131
+ |
132
+ LL | let _: Option<Opcode> = (..3).contains(&op).then(|| unsafe { std::mem::transmute(op) });
133
+ | ~~~~ ++
134
+
135
+ error: this transmute is always evaluated eagerly, even if the condition is false
136
+ --> $DIR/eager_transmute.rs:52:69
137
+ |
138
+ LL | let _: Option<Opcode> = (..=3).contains(&op).then_some(unsafe { std::mem::transmute(op) });
139
+ | ^^^^^^^^^^^^^^^^^^^^^^^
140
+ |
141
+ help: consider using `bool::then` to only transmute if the condition holds
142
+ |
143
+ LL | let _: Option<Opcode> = (..=3).contains(&op).then(|| unsafe { std::mem::transmute(op) });
144
+ | ~~~~ ++
145
+
146
+ error: this transmute is always evaluated eagerly, even if the condition is false
147
+ --> $DIR/eager_transmute.rs:61:24
82
148
|
83
149
LL | (op < 4).then_some(std::mem::transmute::<_, Opcode>(op));
84
150
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -89,7 +155,7 @@ LL | (op < 4).then(|| std::mem::transmute::<_, Opcode>(op));
89
155
| ~~~~ ++
90
156
91
157
error: this transmute is always evaluated eagerly, even if the condition is false
92
- --> $DIR/eager_transmute.rs:77 :60
158
+ --> $DIR/eager_transmute.rs:90 :60
93
159
|
94
160
LL | let _: Option<NonZeroU8> = (v1 > 0).then_some(unsafe { std::mem::transmute(v1) });
95
161
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -100,7 +166,7 @@ LL | let _: Option<NonZeroU8> = (v1 > 0).then(|| unsafe { std::mem::transmut
100
166
| ~~~~ ++
101
167
102
168
error: this transmute is always evaluated eagerly, even if the condition is false
103
- --> $DIR/eager_transmute.rs:83 :86
169
+ --> $DIR/eager_transmute.rs:96 :86
104
170
|
105
171
LL | let _: Option<NonMaxU8> = (v2 < NonZeroU8::new(255).unwrap()).then_some(unsafe { std::mem::transmute(v2) });
106
172
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -111,7 +177,7 @@ LL | let _: Option<NonMaxU8> = (v2 < NonZeroU8::new(255).unwrap()).then(|| u
111
177
| ~~~~ ++
112
178
113
179
error: this transmute is always evaluated eagerly, even if the condition is false
114
- --> $DIR/eager_transmute.rs:89 :93
180
+ --> $DIR/eager_transmute.rs:102 :93
115
181
|
116
182
LL | let _: Option<NonZeroNonMaxU8> = (v2 < NonZeroU8::new(255).unwrap()).then_some(unsafe { std::mem::transmute(v2) });
117
183
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -121,5 +187,5 @@ help: consider using `bool::then` to only transmute if the condition holds
121
187
LL | let _: Option<NonZeroNonMaxU8> = (v2 < NonZeroU8::new(255).unwrap()).then(|| unsafe { std::mem::transmute(v2) });
122
188
| ~~~~ ++
123
189
124
- error: aborting due to 11 previous errors
190
+ error: aborting due to 17 previous errors
125
191
0 commit comments