|
1 | 1 | error: casting `i8` to `f32` may become silently lossy if you later change the type
|
2 |
| - --> $DIR/cast_lossless_float.rs:9:5 |
| 2 | + --> $DIR/cast_lossless_float.rs:9:13 |
3 | 3 | |
|
4 |
| -LL | x0 as f32; |
5 |
| - | ^^^^^^^^^ help: try: `f32::from(x0)` |
| 4 | +LL | let _ = x0 as f32; |
| 5 | + | ^^^^^^^^^ help: try: `f32::from(x0)` |
6 | 6 | |
|
7 | 7 | = note: `-D clippy::cast-lossless` implied by `-D warnings`
|
8 | 8 |
|
9 | 9 | error: casting `i8` to `f64` may become silently lossy if you later change the type
|
10 |
| - --> $DIR/cast_lossless_float.rs:10:5 |
| 10 | + --> $DIR/cast_lossless_float.rs:10:13 |
11 | 11 | |
|
12 |
| -LL | x0 as f64; |
13 |
| - | ^^^^^^^^^ help: try: `f64::from(x0)` |
| 12 | +LL | let _ = x0 as f64; |
| 13 | + | ^^^^^^^^^ help: try: `f64::from(x0)` |
14 | 14 |
|
15 | 15 | error: casting `u8` to `f32` may become silently lossy if you later change the type
|
16 |
| - --> $DIR/cast_lossless_float.rs:12:5 |
| 16 | + --> $DIR/cast_lossless_float.rs:12:13 |
17 | 17 | |
|
18 |
| -LL | x1 as f32; |
19 |
| - | ^^^^^^^^^ help: try: `f32::from(x1)` |
| 18 | +LL | let _ = x1 as f32; |
| 19 | + | ^^^^^^^^^ help: try: `f32::from(x1)` |
20 | 20 |
|
21 | 21 | error: casting `u8` to `f64` may become silently lossy if you later change the type
|
22 |
| - --> $DIR/cast_lossless_float.rs:13:5 |
| 22 | + --> $DIR/cast_lossless_float.rs:13:13 |
23 | 23 | |
|
24 |
| -LL | x1 as f64; |
25 |
| - | ^^^^^^^^^ help: try: `f64::from(x1)` |
| 24 | +LL | let _ = x1 as f64; |
| 25 | + | ^^^^^^^^^ help: try: `f64::from(x1)` |
26 | 26 |
|
27 | 27 | error: casting `i16` to `f32` may become silently lossy if you later change the type
|
28 |
| - --> $DIR/cast_lossless_float.rs:15:5 |
| 28 | + --> $DIR/cast_lossless_float.rs:15:13 |
29 | 29 | |
|
30 |
| -LL | x2 as f32; |
31 |
| - | ^^^^^^^^^ help: try: `f32::from(x2)` |
| 30 | +LL | let _ = x2 as f32; |
| 31 | + | ^^^^^^^^^ help: try: `f32::from(x2)` |
32 | 32 |
|
33 | 33 | error: casting `i16` to `f64` may become silently lossy if you later change the type
|
34 |
| - --> $DIR/cast_lossless_float.rs:16:5 |
| 34 | + --> $DIR/cast_lossless_float.rs:16:13 |
35 | 35 | |
|
36 |
| -LL | x2 as f64; |
37 |
| - | ^^^^^^^^^ help: try: `f64::from(x2)` |
| 36 | +LL | let _ = x2 as f64; |
| 37 | + | ^^^^^^^^^ help: try: `f64::from(x2)` |
38 | 38 |
|
39 | 39 | error: casting `u16` to `f32` may become silently lossy if you later change the type
|
40 |
| - --> $DIR/cast_lossless_float.rs:18:5 |
| 40 | + --> $DIR/cast_lossless_float.rs:18:13 |
41 | 41 | |
|
42 |
| -LL | x3 as f32; |
43 |
| - | ^^^^^^^^^ help: try: `f32::from(x3)` |
| 42 | +LL | let _ = x3 as f32; |
| 43 | + | ^^^^^^^^^ help: try: `f32::from(x3)` |
44 | 44 |
|
45 | 45 | error: casting `u16` to `f64` may become silently lossy if you later change the type
|
46 |
| - --> $DIR/cast_lossless_float.rs:19:5 |
| 46 | + --> $DIR/cast_lossless_float.rs:19:13 |
47 | 47 | |
|
48 |
| -LL | x3 as f64; |
49 |
| - | ^^^^^^^^^ help: try: `f64::from(x3)` |
| 48 | +LL | let _ = x3 as f64; |
| 49 | + | ^^^^^^^^^ help: try: `f64::from(x3)` |
50 | 50 |
|
51 | 51 | error: casting `i32` to `f64` may become silently lossy if you later change the type
|
52 |
| - --> $DIR/cast_lossless_float.rs:21:5 |
| 52 | + --> $DIR/cast_lossless_float.rs:21:13 |
53 | 53 | |
|
54 |
| -LL | x4 as f64; |
55 |
| - | ^^^^^^^^^ help: try: `f64::from(x4)` |
| 54 | +LL | let _ = x4 as f64; |
| 55 | + | ^^^^^^^^^ help: try: `f64::from(x4)` |
56 | 56 |
|
57 | 57 | error: casting `u32` to `f64` may become silently lossy if you later change the type
|
58 |
| - --> $DIR/cast_lossless_float.rs:23:5 |
| 58 | + --> $DIR/cast_lossless_float.rs:23:13 |
59 | 59 | |
|
60 |
| -LL | x5 as f64; |
61 |
| - | ^^^^^^^^^ help: try: `f64::from(x5)` |
| 60 | +LL | let _ = x5 as f64; |
| 61 | + | ^^^^^^^^^ help: try: `f64::from(x5)` |
62 | 62 |
|
63 | 63 | error: casting `f32` to `f64` may become silently lossy if you later change the type
|
64 |
| - --> $DIR/cast_lossless_float.rs:26:5 |
| 64 | + --> $DIR/cast_lossless_float.rs:26:13 |
65 | 65 | |
|
66 |
| -LL | 1.0f32 as f64; |
67 |
| - | ^^^^^^^^^^^^^ help: try: `f64::from(1.0f32)` |
| 66 | +LL | let _ = 1.0f32 as f64; |
| 67 | + | ^^^^^^^^^^^^^ help: try: `f64::from(1.0f32)` |
68 | 68 |
|
69 | 69 | error: aborting due to 11 previous errors
|
70 | 70 |
|
0 commit comments