1
1
error: 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
3
3
|
4
4
LL | (op < 4).then_some(unsafe { std::mem::transmute(op) })
5
5
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -12,7 +12,7 @@ LL | (op < 4).then(|| unsafe { std::mem::transmute(op) })
12
12
| ~~~~ ++
13
13
14
14
error: 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
16
16
|
17
17
LL | (op < 4).then_some(unsafe { std::mem::transmute::<_, Opcode>(op) });
18
18
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -23,7 +23,7 @@ LL | (op < 4).then(|| unsafe { std::mem::transmute::<_, Opcode>(op) });
23
23
| ~~~~ ++
24
24
25
25
error: 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
27
27
|
28
28
LL | (op > 4).then_some(unsafe { std::mem::transmute::<_, Opcode>(op) });
29
29
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -34,7 +34,7 @@ LL | (op > 4).then(|| unsafe { std::mem::transmute::<_, Opcode>(op) });
34
34
| ~~~~ ++
35
35
36
36
error: 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
38
38
|
39
39
LL | (op == 0).then_some(unsafe { std::mem::transmute::<_, Opcode>(op) });
40
40
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -45,7 +45,106 @@ LL | (op == 0).then(|| unsafe { std::mem::transmute::<_, Opcode>(op) });
45
45
| ~~~~ ++
46
46
47
47
error: 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: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
49
148
|
50
149
LL | (op < 4).then_some(std::mem::transmute::<_, Opcode>(op));
51
150
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -56,7 +155,7 @@ LL | (op < 4).then(|| std::mem::transmute::<_, Opcode>(op));
56
155
| ~~~~ ++
57
156
58
157
error: this transmute is always evaluated eagerly, even if the condition is false
59
- --> $DIR/eager_transmute.rs:57 :60
158
+ --> $DIR/eager_transmute.rs:90 :60
60
159
|
61
160
LL | let _: Option<NonZeroU8> = (v1 > 0).then_some(unsafe { std::mem::transmute(v1) });
62
161
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -67,7 +166,7 @@ LL | let _: Option<NonZeroU8> = (v1 > 0).then(|| unsafe { std::mem::transmut
67
166
| ~~~~ ++
68
167
69
168
error: this transmute is always evaluated eagerly, even if the condition is false
70
- --> $DIR/eager_transmute.rs:63 :86
169
+ --> $DIR/eager_transmute.rs:96 :86
71
170
|
72
171
LL | let _: Option<NonMaxU8> = (v2 < NonZeroU8::new(255).unwrap()).then_some(unsafe { std::mem::transmute(v2) });
73
172
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -78,7 +177,7 @@ LL | let _: Option<NonMaxU8> = (v2 < NonZeroU8::new(255).unwrap()).then(|| u
78
177
| ~~~~ ++
79
178
80
179
error: this transmute is always evaluated eagerly, even if the condition is false
81
- --> $DIR/eager_transmute.rs:69 :93
180
+ --> $DIR/eager_transmute.rs:102 :93
82
181
|
83
182
LL | let _: Option<NonZeroNonMaxU8> = (v2 < NonZeroU8::new(255).unwrap()).then_some(unsafe { std::mem::transmute(v2) });
84
183
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -88,5 +187,5 @@ help: consider using `bool::then` to only transmute if the condition holds
88
187
LL | let _: Option<NonZeroNonMaxU8> = (v2 < NonZeroU8::new(255).unwrap()).then(|| unsafe { std::mem::transmute(v2) });
89
188
| ~~~~ ++
90
189
91
- error: aborting due to 8 previous errors
190
+ error: aborting due to 17 previous errors
92
191
0 commit comments