blob: 6899227176236590e8231694391d9970a55f86db (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
|
error: casts from `bool` to `u8` can be expressed infallibly using `From`
--> tests/ui/cast_lossless_bool.rs:8:13
|
LL | let _ = true as u8;
| ^^^^^^^^^^
|
= help: an `as` cast can become silently lossy if the types change in the future
= note: `-D clippy::cast-lossless` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::cast_lossless)]`
help: use `u8::from` instead
|
LL - let _ = true as u8;
LL + let _ = u8::from(true);
|
error: casts from `bool` to `u16` can be expressed infallibly using `From`
--> tests/ui/cast_lossless_bool.rs:9:13
|
LL | let _ = true as u16;
| ^^^^^^^^^^^
|
= help: an `as` cast can become silently lossy if the types change in the future
help: use `u16::from` instead
|
LL - let _ = true as u16;
LL + let _ = u16::from(true);
|
error: casts from `bool` to `u32` can be expressed infallibly using `From`
--> tests/ui/cast_lossless_bool.rs:10:13
|
LL | let _ = true as u32;
| ^^^^^^^^^^^
|
= help: an `as` cast can become silently lossy if the types change in the future
help: use `u32::from` instead
|
LL - let _ = true as u32;
LL + let _ = u32::from(true);
|
error: casts from `bool` to `u64` can be expressed infallibly using `From`
--> tests/ui/cast_lossless_bool.rs:11:13
|
LL | let _ = true as u64;
| ^^^^^^^^^^^
|
= help: an `as` cast can become silently lossy if the types change in the future
help: use `u64::from` instead
|
LL - let _ = true as u64;
LL + let _ = u64::from(true);
|
error: casts from `bool` to `u128` can be expressed infallibly using `From`
--> tests/ui/cast_lossless_bool.rs:12:13
|
LL | let _ = true as u128;
| ^^^^^^^^^^^^
|
= help: an `as` cast can become silently lossy if the types change in the future
help: use `u128::from` instead
|
LL - let _ = true as u128;
LL + let _ = u128::from(true);
|
error: casts from `bool` to `usize` can be expressed infallibly using `From`
--> tests/ui/cast_lossless_bool.rs:13:13
|
LL | let _ = true as usize;
| ^^^^^^^^^^^^^
|
= help: an `as` cast can become silently lossy if the types change in the future
help: use `usize::from` instead
|
LL - let _ = true as usize;
LL + let _ = usize::from(true);
|
error: casts from `bool` to `i8` can be expressed infallibly using `From`
--> tests/ui/cast_lossless_bool.rs:15:13
|
LL | let _ = true as i8;
| ^^^^^^^^^^
|
= help: an `as` cast can become silently lossy if the types change in the future
help: use `i8::from` instead
|
LL - let _ = true as i8;
LL + let _ = i8::from(true);
|
error: casts from `bool` to `i16` can be expressed infallibly using `From`
--> tests/ui/cast_lossless_bool.rs:16:13
|
LL | let _ = true as i16;
| ^^^^^^^^^^^
|
= help: an `as` cast can become silently lossy if the types change in the future
help: use `i16::from` instead
|
LL - let _ = true as i16;
LL + let _ = i16::from(true);
|
error: casts from `bool` to `i32` can be expressed infallibly using `From`
--> tests/ui/cast_lossless_bool.rs:17:13
|
LL | let _ = true as i32;
| ^^^^^^^^^^^
|
= help: an `as` cast can become silently lossy if the types change in the future
help: use `i32::from` instead
|
LL - let _ = true as i32;
LL + let _ = i32::from(true);
|
error: casts from `bool` to `i64` can be expressed infallibly using `From`
--> tests/ui/cast_lossless_bool.rs:18:13
|
LL | let _ = true as i64;
| ^^^^^^^^^^^
|
= help: an `as` cast can become silently lossy if the types change in the future
help: use `i64::from` instead
|
LL - let _ = true as i64;
LL + let _ = i64::from(true);
|
error: casts from `bool` to `i128` can be expressed infallibly using `From`
--> tests/ui/cast_lossless_bool.rs:19:13
|
LL | let _ = true as i128;
| ^^^^^^^^^^^^
|
= help: an `as` cast can become silently lossy if the types change in the future
help: use `i128::from` instead
|
LL - let _ = true as i128;
LL + let _ = i128::from(true);
|
error: casts from `bool` to `isize` can be expressed infallibly using `From`
--> tests/ui/cast_lossless_bool.rs:20:13
|
LL | let _ = true as isize;
| ^^^^^^^^^^^^^
|
= help: an `as` cast can become silently lossy if the types change in the future
help: use `isize::from` instead
|
LL - let _ = true as isize;
LL + let _ = isize::from(true);
|
error: casts from `bool` to `u16` can be expressed infallibly using `From`
--> tests/ui/cast_lossless_bool.rs:23:13
|
LL | let _ = (true | false) as u16;
| ^^^^^^^^^^^^^^^^^^^^^
|
= help: an `as` cast can become silently lossy if the types change in the future
help: use `u16::from` instead
|
LL - let _ = (true | false) as u16;
LL + let _ = u16::from(true | false);
|
error: casts from `bool` to `u8` can be expressed infallibly using `From`
--> tests/ui/cast_lossless_bool.rs:25:13
|
LL | let _ = true as U8;
| ^^^^^^^^^^
|
= help: an `as` cast can become silently lossy if the types change in the future
help: use `U8::from` instead
|
LL - let _ = true as U8;
LL + let _ = U8::from(true);
|
error: casts from `bool` to `u8` can be expressed infallibly using `From`
--> tests/ui/cast_lossless_bool.rs:53:13
|
LL | let _ = true as u8;
| ^^^^^^^^^^
|
= help: an `as` cast can become silently lossy if the types change in the future
help: use `u8::from` instead
|
LL - let _ = true as u8;
LL + let _ = u8::from(true);
|
error: aborting due to 15 previous errors
|