mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-18 17:15:05 +00:00
464 lines
12 KiB
Text
464 lines
12 KiB
Text
error: casting i32 to f32 causes a loss of precision (i32 is 32 bits wide, but f32's mantissa is only 23 bits wide)
|
|
--> $DIR/cast.rs:8:5
|
|
|
|
|
8 | 1i32 as f32;
|
|
| ^^^^^^^^^^^
|
|
|
|
|
= note: `-D cast-precision-loss` implied by `-D warnings`
|
|
|
|
error: casting i64 to f32 causes a loss of precision (i64 is 64 bits wide, but f32's mantissa is only 23 bits wide)
|
|
--> $DIR/cast.rs:9:5
|
|
|
|
|
9 | 1i64 as f32;
|
|
| ^^^^^^^^^^^
|
|
|
|
error: casting i64 to f64 causes a loss of precision (i64 is 64 bits wide, but f64's mantissa is only 52 bits wide)
|
|
--> $DIR/cast.rs:10:5
|
|
|
|
|
10 | 1i64 as f64;
|
|
| ^^^^^^^^^^^
|
|
|
|
error: casting u32 to f32 causes a loss of precision (u32 is 32 bits wide, but f32's mantissa is only 23 bits wide)
|
|
--> $DIR/cast.rs:11:5
|
|
|
|
|
11 | 1u32 as f32;
|
|
| ^^^^^^^^^^^
|
|
|
|
error: casting u64 to f32 causes a loss of precision (u64 is 64 bits wide, but f32's mantissa is only 23 bits wide)
|
|
--> $DIR/cast.rs:12:5
|
|
|
|
|
12 | 1u64 as f32;
|
|
| ^^^^^^^^^^^
|
|
|
|
error: casting u64 to f64 causes a loss of precision (u64 is 64 bits wide, but f64's mantissa is only 52 bits wide)
|
|
--> $DIR/cast.rs:13:5
|
|
|
|
|
13 | 1u64 as f64;
|
|
| ^^^^^^^^^^^
|
|
|
|
error: casting f32 to i32 may truncate the value
|
|
--> $DIR/cast.rs:15:5
|
|
|
|
|
15 | 1f32 as i32;
|
|
| ^^^^^^^^^^^
|
|
|
|
|
= note: `-D cast-possible-truncation` implied by `-D warnings`
|
|
|
|
error: casting f32 to u32 may truncate the value
|
|
--> $DIR/cast.rs:16:5
|
|
|
|
|
16 | 1f32 as u32;
|
|
| ^^^^^^^^^^^
|
|
|
|
error: casting f32 to u32 may lose the sign of the value
|
|
--> $DIR/cast.rs:16:5
|
|
|
|
|
16 | 1f32 as u32;
|
|
| ^^^^^^^^^^^
|
|
|
|
|
= note: `-D cast-sign-loss` implied by `-D warnings`
|
|
|
|
error: casting f64 to f32 may truncate the value
|
|
--> $DIR/cast.rs:17:5
|
|
|
|
|
17 | 1f64 as f32;
|
|
| ^^^^^^^^^^^
|
|
|
|
error: casting i32 to i8 may truncate the value
|
|
--> $DIR/cast.rs:18:5
|
|
|
|
|
18 | 1i32 as i8;
|
|
| ^^^^^^^^^^
|
|
|
|
error: casting i32 to u8 may lose the sign of the value
|
|
--> $DIR/cast.rs:19:5
|
|
|
|
|
19 | 1i32 as u8;
|
|
| ^^^^^^^^^^
|
|
|
|
error: casting i32 to u8 may truncate the value
|
|
--> $DIR/cast.rs:19:5
|
|
|
|
|
19 | 1i32 as u8;
|
|
| ^^^^^^^^^^
|
|
|
|
error: casting f64 to isize may truncate the value
|
|
--> $DIR/cast.rs:20:5
|
|
|
|
|
20 | 1f64 as isize;
|
|
| ^^^^^^^^^^^^^
|
|
|
|
error: casting f64 to usize may truncate the value
|
|
--> $DIR/cast.rs:21:5
|
|
|
|
|
21 | 1f64 as usize;
|
|
| ^^^^^^^^^^^^^
|
|
|
|
error: casting f64 to usize may lose the sign of the value
|
|
--> $DIR/cast.rs:21:5
|
|
|
|
|
21 | 1f64 as usize;
|
|
| ^^^^^^^^^^^^^
|
|
|
|
error: casting u8 to i8 may wrap around the value
|
|
--> $DIR/cast.rs:23:5
|
|
|
|
|
23 | 1u8 as i8;
|
|
| ^^^^^^^^^
|
|
|
|
|
= note: `-D cast-possible-wrap` implied by `-D warnings`
|
|
|
|
error: casting u16 to i16 may wrap around the value
|
|
--> $DIR/cast.rs:24:5
|
|
|
|
|
24 | 1u16 as i16;
|
|
| ^^^^^^^^^^^
|
|
|
|
error: casting u32 to i32 may wrap around the value
|
|
--> $DIR/cast.rs:25:5
|
|
|
|
|
25 | 1u32 as i32;
|
|
| ^^^^^^^^^^^
|
|
|
|
error: casting u64 to i64 may wrap around the value
|
|
--> $DIR/cast.rs:26:5
|
|
|
|
|
26 | 1u64 as i64;
|
|
| ^^^^^^^^^^^
|
|
|
|
error: casting usize to isize may wrap around the value
|
|
--> $DIR/cast.rs:27:5
|
|
|
|
|
27 | 1usize as isize;
|
|
| ^^^^^^^^^^^^^^^
|
|
|
|
error: casting i8 to i16 may become silently lossy if types change
|
|
--> $DIR/cast.rs:29:5
|
|
|
|
|
29 | 1i8 as i16;
|
|
| ^^^^^^^^^^ help: try: `i16::from(1i8)`
|
|
|
|
|
= note: `-D cast-lossless` implied by `-D warnings`
|
|
|
|
error: casting i8 to i32 may become silently lossy if types change
|
|
--> $DIR/cast.rs:30:5
|
|
|
|
|
30 | 1i8 as i32;
|
|
| ^^^^^^^^^^ help: try: `i32::from(1i8)`
|
|
|
|
error: casting i8 to i64 may become silently lossy if types change
|
|
--> $DIR/cast.rs:31:5
|
|
|
|
|
31 | 1i8 as i64;
|
|
| ^^^^^^^^^^ help: try: `i64::from(1i8)`
|
|
|
|
error: casting u8 to i16 may become silently lossy if types change
|
|
--> $DIR/cast.rs:32:5
|
|
|
|
|
32 | 1u8 as i16;
|
|
| ^^^^^^^^^^ help: try: `i16::from(1u8)`
|
|
|
|
error: casting u8 to i32 may become silently lossy if types change
|
|
--> $DIR/cast.rs:33:5
|
|
|
|
|
33 | 1u8 as i32;
|
|
| ^^^^^^^^^^ help: try: `i32::from(1u8)`
|
|
|
|
error: casting u8 to i64 may become silently lossy if types change
|
|
--> $DIR/cast.rs:34:5
|
|
|
|
|
34 | 1u8 as i64;
|
|
| ^^^^^^^^^^ help: try: `i64::from(1u8)`
|
|
|
|
error: casting u8 to u16 may become silently lossy if types change
|
|
--> $DIR/cast.rs:35:5
|
|
|
|
|
35 | 1u8 as u16;
|
|
| ^^^^^^^^^^ help: try: `u16::from(1u8)`
|
|
|
|
error: casting u8 to u32 may become silently lossy if types change
|
|
--> $DIR/cast.rs:36:5
|
|
|
|
|
36 | 1u8 as u32;
|
|
| ^^^^^^^^^^ help: try: `u32::from(1u8)`
|
|
|
|
error: casting u8 to u64 may become silently lossy if types change
|
|
--> $DIR/cast.rs:37:5
|
|
|
|
|
37 | 1u8 as u64;
|
|
| ^^^^^^^^^^ help: try: `u64::from(1u8)`
|
|
|
|
error: casting i16 to i32 may become silently lossy if types change
|
|
--> $DIR/cast.rs:38:5
|
|
|
|
|
38 | 1i16 as i32;
|
|
| ^^^^^^^^^^^ help: try: `i32::from(1i16)`
|
|
|
|
error: casting i16 to i64 may become silently lossy if types change
|
|
--> $DIR/cast.rs:39:5
|
|
|
|
|
39 | 1i16 as i64;
|
|
| ^^^^^^^^^^^ help: try: `i64::from(1i16)`
|
|
|
|
error: casting u16 to i32 may become silently lossy if types change
|
|
--> $DIR/cast.rs:40:5
|
|
|
|
|
40 | 1u16 as i32;
|
|
| ^^^^^^^^^^^ help: try: `i32::from(1u16)`
|
|
|
|
error: casting u16 to i64 may become silently lossy if types change
|
|
--> $DIR/cast.rs:41:5
|
|
|
|
|
41 | 1u16 as i64;
|
|
| ^^^^^^^^^^^ help: try: `i64::from(1u16)`
|
|
|
|
error: casting u16 to u32 may become silently lossy if types change
|
|
--> $DIR/cast.rs:42:5
|
|
|
|
|
42 | 1u16 as u32;
|
|
| ^^^^^^^^^^^ help: try: `u32::from(1u16)`
|
|
|
|
error: casting u16 to u64 may become silently lossy if types change
|
|
--> $DIR/cast.rs:43:5
|
|
|
|
|
43 | 1u16 as u64;
|
|
| ^^^^^^^^^^^ help: try: `u64::from(1u16)`
|
|
|
|
error: casting i32 to i64 may become silently lossy if types change
|
|
--> $DIR/cast.rs:44:5
|
|
|
|
|
44 | 1i32 as i64;
|
|
| ^^^^^^^^^^^ help: try: `i64::from(1i32)`
|
|
|
|
error: casting u32 to i64 may become silently lossy if types change
|
|
--> $DIR/cast.rs:45:5
|
|
|
|
|
45 | 1u32 as i64;
|
|
| ^^^^^^^^^^^ help: try: `i64::from(1u32)`
|
|
|
|
error: casting u32 to u64 may become silently lossy if types change
|
|
--> $DIR/cast.rs:46:5
|
|
|
|
|
46 | 1u32 as u64;
|
|
| ^^^^^^^^^^^ help: try: `u64::from(1u32)`
|
|
|
|
error: casting i8 to f32 may become silently lossy if types change
|
|
--> $DIR/cast.rs:48:5
|
|
|
|
|
48 | 1i8 as f32;
|
|
| ^^^^^^^^^^ help: try: `f32::from(1i8)`
|
|
|
|
error: casting i8 to f64 may become silently lossy if types change
|
|
--> $DIR/cast.rs:49:5
|
|
|
|
|
49 | 1i8 as f64;
|
|
| ^^^^^^^^^^ help: try: `f64::from(1i8)`
|
|
|
|
error: casting u8 to f32 may become silently lossy if types change
|
|
--> $DIR/cast.rs:50:5
|
|
|
|
|
50 | 1u8 as f32;
|
|
| ^^^^^^^^^^ help: try: `f32::from(1u8)`
|
|
|
|
error: casting u8 to f64 may become silently lossy if types change
|
|
--> $DIR/cast.rs:51:5
|
|
|
|
|
51 | 1u8 as f64;
|
|
| ^^^^^^^^^^ help: try: `f64::from(1u8)`
|
|
|
|
error: casting i16 to f32 may become silently lossy if types change
|
|
--> $DIR/cast.rs:52:5
|
|
|
|
|
52 | 1i16 as f32;
|
|
| ^^^^^^^^^^^ help: try: `f32::from(1i16)`
|
|
|
|
error: casting i16 to f64 may become silently lossy if types change
|
|
--> $DIR/cast.rs:53:5
|
|
|
|
|
53 | 1i16 as f64;
|
|
| ^^^^^^^^^^^ help: try: `f64::from(1i16)`
|
|
|
|
error: casting u16 to f32 may become silently lossy if types change
|
|
--> $DIR/cast.rs:54:5
|
|
|
|
|
54 | 1u16 as f32;
|
|
| ^^^^^^^^^^^ help: try: `f32::from(1u16)`
|
|
|
|
error: casting u16 to f64 may become silently lossy if types change
|
|
--> $DIR/cast.rs:55:5
|
|
|
|
|
55 | 1u16 as f64;
|
|
| ^^^^^^^^^^^ help: try: `f64::from(1u16)`
|
|
|
|
error: casting i32 to f64 may become silently lossy if types change
|
|
--> $DIR/cast.rs:56:5
|
|
|
|
|
56 | 1i32 as f64;
|
|
| ^^^^^^^^^^^ help: try: `f64::from(1i32)`
|
|
|
|
error: casting u32 to f64 may become silently lossy if types change
|
|
--> $DIR/cast.rs:57:5
|
|
|
|
|
57 | 1u32 as f64;
|
|
| ^^^^^^^^^^^ help: try: `f64::from(1u32)`
|
|
|
|
error: casting f32 to f64 may become silently lossy if types change
|
|
--> $DIR/cast.rs:59:5
|
|
|
|
|
59 | 1.0f32 as f64;
|
|
| ^^^^^^^^^^^^^ help: try: `f64::from(1.0f32)`
|
|
|
|
error: casting u8 to u16 may become silently lossy if types change
|
|
--> $DIR/cast.rs:61:5
|
|
|
|
|
61 | (1u8 + 1u8) as u16;
|
|
| ^^^^^^^^^^^^^^^^^^ help: try: `u16::from(1u8 + 1u8)`
|
|
|
|
error: casting i32 to u32 may lose the sign of the value
|
|
--> $DIR/cast.rs:63:5
|
|
|
|
|
63 | 1i32 as u32;
|
|
| ^^^^^^^^^^^
|
|
|
|
error: casting isize to usize may lose the sign of the value
|
|
--> $DIR/cast.rs:64:5
|
|
|
|
|
64 | 1isize as usize;
|
|
| ^^^^^^^^^^^^^^^
|
|
|
|
error: casting isize to i8 may truncate the value
|
|
--> $DIR/cast.rs:67:5
|
|
|
|
|
67 | 1isize as i8;
|
|
| ^^^^^^^^^^^^
|
|
|
|
error: casting isize to f64 causes a loss of precision on targets with 64-bit wide pointers (isize is 64 bits wide, but f64's mantissa is only 52 bits wide)
|
|
--> $DIR/cast.rs:68:5
|
|
|
|
|
68 | 1isize as f64;
|
|
| ^^^^^^^^^^^^^
|
|
|
|
error: casting usize to f64 causes a loss of precision on targets with 64-bit wide pointers (usize is 64 bits wide, but f64's mantissa is only 52 bits wide)
|
|
--> $DIR/cast.rs:69:5
|
|
|
|
|
69 | 1usize as f64;
|
|
| ^^^^^^^^^^^^^
|
|
|
|
error: casting isize to f32 causes a loss of precision (isize is 32 or 64 bits wide, but f32's mantissa is only 23 bits wide)
|
|
--> $DIR/cast.rs:70:5
|
|
|
|
|
70 | 1isize as f32;
|
|
| ^^^^^^^^^^^^^
|
|
|
|
error: casting usize to f32 causes a loss of precision (usize is 32 or 64 bits wide, but f32's mantissa is only 23 bits wide)
|
|
--> $DIR/cast.rs:71:5
|
|
|
|
|
71 | 1usize as f32;
|
|
| ^^^^^^^^^^^^^
|
|
|
|
error: casting isize to i32 may truncate the value on targets with 64-bit wide pointers
|
|
--> $DIR/cast.rs:72:5
|
|
|
|
|
72 | 1isize as i32;
|
|
| ^^^^^^^^^^^^^
|
|
|
|
error: casting isize to u32 may lose the sign of the value
|
|
--> $DIR/cast.rs:73:5
|
|
|
|
|
73 | 1isize as u32;
|
|
| ^^^^^^^^^^^^^
|
|
|
|
error: casting isize to u32 may truncate the value on targets with 64-bit wide pointers
|
|
--> $DIR/cast.rs:73:5
|
|
|
|
|
73 | 1isize as u32;
|
|
| ^^^^^^^^^^^^^
|
|
|
|
error: casting usize to u32 may truncate the value on targets with 64-bit wide pointers
|
|
--> $DIR/cast.rs:74:5
|
|
|
|
|
74 | 1usize as u32;
|
|
| ^^^^^^^^^^^^^
|
|
|
|
error: casting usize to i32 may truncate the value on targets with 64-bit wide pointers
|
|
--> $DIR/cast.rs:75:5
|
|
|
|
|
75 | 1usize as i32;
|
|
| ^^^^^^^^^^^^^
|
|
|
|
error: casting usize to i32 may wrap around the value on targets with 32-bit wide pointers
|
|
--> $DIR/cast.rs:75:5
|
|
|
|
|
75 | 1usize as i32;
|
|
| ^^^^^^^^^^^^^
|
|
|
|
error: casting i64 to isize may truncate the value on targets with 32-bit wide pointers
|
|
--> $DIR/cast.rs:77:5
|
|
|
|
|
77 | 1i64 as isize;
|
|
| ^^^^^^^^^^^^^
|
|
|
|
error: casting i64 to usize may lose the sign of the value
|
|
--> $DIR/cast.rs:78:5
|
|
|
|
|
78 | 1i64 as usize;
|
|
| ^^^^^^^^^^^^^
|
|
|
|
error: casting i64 to usize may truncate the value on targets with 32-bit wide pointers
|
|
--> $DIR/cast.rs:78:5
|
|
|
|
|
78 | 1i64 as usize;
|
|
| ^^^^^^^^^^^^^
|
|
|
|
error: casting u64 to isize may truncate the value on targets with 32-bit wide pointers
|
|
--> $DIR/cast.rs:79:5
|
|
|
|
|
79 | 1u64 as isize;
|
|
| ^^^^^^^^^^^^^
|
|
|
|
error: casting u64 to isize may wrap around the value on targets with 64-bit wide pointers
|
|
--> $DIR/cast.rs:79:5
|
|
|
|
|
79 | 1u64 as isize;
|
|
| ^^^^^^^^^^^^^
|
|
|
|
error: casting u64 to usize may truncate the value on targets with 32-bit wide pointers
|
|
--> $DIR/cast.rs:80:5
|
|
|
|
|
80 | 1u64 as usize;
|
|
| ^^^^^^^^^^^^^
|
|
|
|
error: casting u32 to isize may wrap around the value on targets with 32-bit wide pointers
|
|
--> $DIR/cast.rs:81:5
|
|
|
|
|
81 | 1u32 as isize;
|
|
| ^^^^^^^^^^^^^
|
|
|
|
error: casting i32 to usize may lose the sign of the value
|
|
--> $DIR/cast.rs:84:5
|
|
|
|
|
84 | 1i32 as usize;
|
|
| ^^^^^^^^^^^^^
|
|
|
|
error: casting to the same type is unnecessary (`i32` -> `i32`)
|
|
--> $DIR/cast.rs:86:5
|
|
|
|
|
86 | 1i32 as i32;
|
|
| ^^^^^^^^^^^
|
|
|
|
|
= note: `-D unnecessary-cast` implied by `-D warnings`
|
|
|
|
error: casting to the same type is unnecessary (`f32` -> `f32`)
|
|
--> $DIR/cast.rs:87:5
|
|
|
|
|
87 | 1f32 as f32;
|
|
| ^^^^^^^^^^^
|
|
|
|
error: casting to the same type is unnecessary (`bool` -> `bool`)
|
|
--> $DIR/cast.rs:88:5
|
|
|
|
|
88 | false as bool;
|
|
| ^^^^^^^^^^^^^
|
|
|
|
error: aborting due to 75 previous errors
|
|
|