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,40 @@ 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:48:24
49
82
|
50
83
LL | (op < 4).then_some(std::mem::transmute::<_, Opcode>(op));
51
84
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -56,7 +89,7 @@ LL | (op < 4).then(|| std::mem::transmute::<_, Opcode>(op));
56
89
| ~~~~ ++
57
90
58
91
error: 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
60
93
|
61
94
LL | let _: Option<NonZeroU8> = (v1 > 0).then_some(unsafe { std::mem::transmute(v1) });
62
95
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -67,7 +100,7 @@ LL | let _: Option<NonZeroU8> = (v1 > 0).then(|| unsafe { std::mem::transmut
67
100
| ~~~~ ++
68
101
69
102
error: 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
71
104
|
72
105
LL | let _: Option<NonMaxU8> = (v2 < NonZeroU8::new(255).unwrap()).then_some(unsafe { std::mem::transmute(v2) });
73
106
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -78,7 +111,7 @@ LL | let _: Option<NonMaxU8> = (v2 < NonZeroU8::new(255).unwrap()).then(|| u
78
111
| ~~~~ ++
79
112
80
113
error: 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
82
115
|
83
116
LL | let _: Option<NonZeroNonMaxU8> = (v2 < NonZeroU8::new(255).unwrap()).then_some(unsafe { std::mem::transmute(v2) });
84
117
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -88,5 +121,5 @@ help: consider using `bool::then` to only transmute if the condition holds
88
121
LL | let _: Option<NonZeroNonMaxU8> = (v2 < NonZeroU8::new(255).unwrap()).then(|| unsafe { std::mem::transmute(v2) });
89
122
| ~~~~ ++
90
123
91
- error: aborting due to 8 previous errors
124
+ error: aborting due to 11 previous errors
92
125
0 commit comments