1 error: casting `i32` to `f32` causes a loss of precision (`i32` is 32 bits wide, but `f32`'s mantissa is only 23 bits wide)
7 = note: `-D clippy::cast-precision-loss` implied by `-D warnings`
8 = help: to override `-D warnings` add `#[allow(clippy::cast_precision_loss)]`
10 error: casting `i64` to `f32` causes a loss of precision (`i64` is 64 bits wide, but `f32`'s mantissa is only 23 bits wide)
16 error: casting `i64` to `f64` causes a loss of precision (`i64` is 64 bits wide, but `f64`'s mantissa is only 52 bits wide)
22 error: casting `u32` to `f32` causes a loss of precision (`u32` is 32 bits wide, but `f32`'s mantissa is only 23 bits wide)
28 error: casting `u64` to `f32` causes a loss of precision (`u64` is 64 bits wide, but `f32`'s mantissa is only 23 bits wide)
34 error: casting `u64` to `f64` causes a loss of precision (`u64` is 64 bits wide, but `f64`'s mantissa is only 52 bits wide)
40 error: casting `f32` to `i32` may truncate the value
46 = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
47 = note: `-D clippy::cast-possible-truncation` implied by `-D warnings`
48 = help: to override `-D warnings` add `#[allow(clippy::cast_possible_truncation)]`
50 error: casting `f32` to `u32` may truncate the value
56 = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
58 error: casting `f32` to `u32` may lose the sign of the value
64 = note: `-D clippy::cast-sign-loss` implied by `-D warnings`
65 = help: to override `-D warnings` add `#[allow(clippy::cast_sign_loss)]`
67 error: casting `f64` to `f32` may truncate the value
73 = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
75 error: casting `i32` to `i8` may truncate the value
81 = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
82 help: ... or use `try_from` and handle the error accordingly
84 LL | i8::try_from(1i32);
87 error: casting `i32` to `u8` may truncate the value
93 = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
94 help: ... or use `try_from` and handle the error accordingly
96 LL | u8::try_from(1i32);
99 error: casting `f64` to `isize` may truncate the value
100 --> $DIR/cast.rs:45:5
105 = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
107 error: casting `f64` to `usize` may truncate the value
108 --> $DIR/cast.rs:47:5
113 = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
115 error: casting `f64` to `usize` may lose the sign of the value
116 --> $DIR/cast.rs:47:5
121 error: casting `u32` to `u16` may truncate the value
122 --> $DIR/cast.rs:50:5
124 LL | 1f32 as u32 as u16;
127 = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
128 help: ... or use `try_from` and handle the error accordingly
130 LL | u16::try_from(1f32 as u32);
131 | ~~~~~~~~~~~~~~~~~~~~~~~~~~
133 error: casting `f32` to `u32` may truncate the value
134 --> $DIR/cast.rs:50:5
136 LL | 1f32 as u32 as u16;
139 = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
141 error: casting `f32` to `u32` may lose the sign of the value
142 --> $DIR/cast.rs:50:5
144 LL | 1f32 as u32 as u16;
147 error: casting `i32` to `i8` may truncate the value
148 --> $DIR/cast.rs:55:22
150 LL | let _x: i8 = 1i32 as _;
153 = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
154 help: ... or use `try_from` and handle the error accordingly
156 LL | let _x: i8 = 1i32.try_into();
159 error: casting `f32` to `i32` may truncate the value
160 --> $DIR/cast.rs:57:9
165 = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
167 error: casting `f64` to `i32` may truncate the value
168 --> $DIR/cast.rs:59:9
173 = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
175 error: casting `f32` to `u8` may truncate the value
176 --> $DIR/cast.rs:61:9
181 = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
183 error: casting `f32` to `u8` may lose the sign of the value
184 --> $DIR/cast.rs:61:9
189 error: casting `u8` to `i8` may wrap around the value
190 --> $DIR/cast.rs:66:5
195 = note: `-D clippy::cast-possible-wrap` implied by `-D warnings`
196 = help: to override `-D warnings` add `#[allow(clippy::cast_possible_wrap)]`
198 error: casting `u16` to `i16` may wrap around the value
199 --> $DIR/cast.rs:69:5
204 error: casting `u32` to `i32` may wrap around the value
205 --> $DIR/cast.rs:71:5
210 error: casting `u64` to `i64` may wrap around the value
211 --> $DIR/cast.rs:73:5
216 error: casting `usize` to `isize` may wrap around the value
217 --> $DIR/cast.rs:75:5
219 LL | 1usize as isize;
222 error: casting `usize` to `i8` may truncate the value
223 --> $DIR/cast.rs:78:5
228 = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
229 help: ... or use `try_from` and handle the error accordingly
231 LL | i8::try_from(1usize);
232 | ~~~~~~~~~~~~~~~~~~~~
234 error: casting `usize` to `i16` may truncate the value
235 --> $DIR/cast.rs:81:5
240 = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
241 help: ... or use `try_from` and handle the error accordingly
243 LL | i16::try_from(1usize);
244 | ~~~~~~~~~~~~~~~~~~~~~
246 error: casting `usize` to `i16` may wrap around the value on targets with 16-bit wide pointers
247 --> $DIR/cast.rs:81:5
252 = note: `usize` and `isize` may be as small as 16 bits on some platforms
253 = note: for more information see https://doc.rust-lang.org/reference/types/numeric.html#machine-dependent-integer-types
255 error: casting `usize` to `i32` may truncate the value on targets with 64-bit wide pointers
256 --> $DIR/cast.rs:86:5
261 = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
262 help: ... or use `try_from` and handle the error accordingly
264 LL | i32::try_from(1usize);
265 | ~~~~~~~~~~~~~~~~~~~~~
267 error: casting `usize` to `i32` may wrap around the value on targets with 32-bit wide pointers
268 --> $DIR/cast.rs:86:5
273 error: casting `usize` to `i64` may wrap around the value on targets with 64-bit wide pointers
274 --> $DIR/cast.rs:90:5
279 error: casting `u16` to `isize` may wrap around the value on targets with 16-bit wide pointers
280 --> $DIR/cast.rs:95:5
285 = note: `usize` and `isize` may be as small as 16 bits on some platforms
286 = note: for more information see https://doc.rust-lang.org/reference/types/numeric.html#machine-dependent-integer-types
288 error: casting `u32` to `isize` may wrap around the value on targets with 32-bit wide pointers
289 --> $DIR/cast.rs:99:5
294 error: casting `u64` to `isize` may truncate the value on targets with 32-bit wide pointers
295 --> $DIR/cast.rs:102:5
300 = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
301 help: ... or use `try_from` and handle the error accordingly
303 LL | isize::try_from(1u64);
304 | ~~~~~~~~~~~~~~~~~~~~~
306 error: casting `u64` to `isize` may wrap around the value on targets with 64-bit wide pointers
307 --> $DIR/cast.rs:102:5
312 error: casting `i32` to `u32` may lose the sign of the value
313 --> $DIR/cast.rs:107:5
318 error: casting `isize` to `usize` may lose the sign of the value
319 --> $DIR/cast.rs:110:5
321 LL | -1isize as usize;
324 error: casting `i64` to `i8` may truncate the value
325 --> $DIR/cast.rs:179:5
327 LL | (-99999999999i64).min(1) as i8;
328 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
330 = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
331 help: ... or use `try_from` and handle the error accordingly
333 LL | i8::try_from((-99999999999i64).min(1));
334 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
336 error: casting `u64` to `u8` may truncate the value
337 --> $DIR/cast.rs:193:5
339 LL | 999999u64.clamp(0, 256) as u8;
340 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
342 = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
343 help: ... or use `try_from` and handle the error accordingly
345 LL | u8::try_from(999999u64.clamp(0, 256));
346 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
348 error: casting `main::E2` to `u8` may truncate the value
349 --> $DIR/cast.rs:216:21
351 LL | let _ = self as u8;
354 = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
355 help: ... or use `try_from` and handle the error accordingly
357 LL | let _ = u8::try_from(self);
360 error: casting `main::E2::B` to `u8` will truncate the value
361 --> $DIR/cast.rs:218:21
363 LL | let _ = Self::B as u8;
366 = note: `-D clippy::cast-enum-truncation` implied by `-D warnings`
367 = help: to override `-D warnings` add `#[allow(clippy::cast_enum_truncation)]`
369 error: casting `main::E5` to `i8` may truncate the value
370 --> $DIR/cast.rs:260:21
372 LL | let _ = self as i8;
375 = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
376 help: ... or use `try_from` and handle the error accordingly
378 LL | let _ = i8::try_from(self);
381 error: casting `main::E5::A` to `i8` will truncate the value
382 --> $DIR/cast.rs:262:21
384 LL | let _ = Self::A as i8;
387 error: casting `main::E6` to `i16` may truncate the value
388 --> $DIR/cast.rs:279:21
390 LL | let _ = self as i16;
393 = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
394 help: ... or use `try_from` and handle the error accordingly
396 LL | let _ = i16::try_from(self);
397 | ~~~~~~~~~~~~~~~~~~~
399 error: casting `main::E7` to `usize` may truncate the value on targets with 32-bit wide pointers
400 --> $DIR/cast.rs:298:21
402 LL | let _ = self as usize;
405 = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
406 help: ... or use `try_from` and handle the error accordingly
408 LL | let _ = usize::try_from(self);
409 | ~~~~~~~~~~~~~~~~~~~~~
411 error: casting `main::E10` to `u16` may truncate the value
412 --> $DIR/cast.rs:345:21
414 LL | let _ = self as u16;
417 = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
418 help: ... or use `try_from` and handle the error accordingly
420 LL | let _ = u16::try_from(self);
421 | ~~~~~~~~~~~~~~~~~~~
423 error: casting `u32` to `u8` may truncate the value
424 --> $DIR/cast.rs:356:13
426 LL | let c = (q >> 16) as u8;
429 = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
430 help: ... or use `try_from` and handle the error accordingly
432 LL | let c = u8::try_from(q >> 16);
433 | ~~~~~~~~~~~~~~~~~~~~~
435 error: casting `u32` to `u8` may truncate the value
436 --> $DIR/cast.rs:360:13
438 LL | let c = (q / 1000) as u8;
441 = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
442 help: ... or use `try_from` and handle the error accordingly
444 LL | let c = u8::try_from(q / 1000);
445 | ~~~~~~~~~~~~~~~~~~~~~~
447 error: aborting due to 51 previous errors