|
1 | 1 | error: casting the result of `i32::abs()` to u32
|
2 |
| - --> $DIR/cast_abs_to_unsigned.rs:7:18 |
| 2 | + --> $DIR/cast_abs_to_unsigned.rs:9:18 |
3 | 3 | |
|
4 | 4 | LL | let y: u32 = x.abs() as u32;
|
5 | 5 | | ^^^^^^^^^^^^^^ help: replace with: `x.unsigned_abs()`
|
6 | 6 | |
|
7 | 7 | = note: `-D clippy::cast-abs-to-unsigned` implied by `-D warnings`
|
8 | 8 |
|
9 | 9 | error: casting the result of `i32::abs()` to usize
|
10 |
| - --> $DIR/cast_abs_to_unsigned.rs:11:20 |
| 10 | + --> $DIR/cast_abs_to_unsigned.rs:13:20 |
11 | 11 | |
|
12 | 12 | LL | let _: usize = a.abs() as usize;
|
13 | 13 | | ^^^^^^^ help: replace with: `a.unsigned_abs()`
|
14 | 14 |
|
15 | 15 | error: casting the result of `i32::abs()` to usize
|
16 |
| - --> $DIR/cast_abs_to_unsigned.rs:12:20 |
| 16 | + --> $DIR/cast_abs_to_unsigned.rs:14:20 |
17 | 17 | |
|
18 | 18 | LL | let _: usize = a.abs() as _;
|
19 | 19 | | ^^^^^^^ help: replace with: `a.unsigned_abs()`
|
20 | 20 |
|
21 | 21 | error: casting the result of `i32::abs()` to usize
|
22 |
| - --> $DIR/cast_abs_to_unsigned.rs:13:13 |
| 22 | + --> $DIR/cast_abs_to_unsigned.rs:15:13 |
23 | 23 | |
|
24 | 24 | LL | let _ = a.abs() as usize;
|
25 | 25 | | ^^^^^^^ help: replace with: `a.unsigned_abs()`
|
26 | 26 |
|
27 | 27 | error: casting the result of `i64::abs()` to usize
|
28 |
| - --> $DIR/cast_abs_to_unsigned.rs:16:13 |
| 28 | + --> $DIR/cast_abs_to_unsigned.rs:18:13 |
29 | 29 | |
|
30 | 30 | LL | let _ = a.abs() as usize;
|
31 | 31 | | ^^^^^^^ help: replace with: `a.unsigned_abs()`
|
32 | 32 |
|
33 | 33 | error: casting the result of `i64::abs()` to u8
|
34 |
| - --> $DIR/cast_abs_to_unsigned.rs:17:13 |
| 34 | + --> $DIR/cast_abs_to_unsigned.rs:19:13 |
35 | 35 | |
|
36 | 36 | LL | let _ = a.abs() as u8;
|
37 | 37 | | ^^^^^^^ help: replace with: `a.unsigned_abs()`
|
38 | 38 |
|
39 | 39 | error: casting the result of `i64::abs()` to u16
|
40 |
| - --> $DIR/cast_abs_to_unsigned.rs:18:13 |
| 40 | + --> $DIR/cast_abs_to_unsigned.rs:20:13 |
41 | 41 | |
|
42 | 42 | LL | let _ = a.abs() as u16;
|
43 | 43 | | ^^^^^^^ help: replace with: `a.unsigned_abs()`
|
44 | 44 |
|
45 | 45 | error: casting the result of `i64::abs()` to u32
|
46 |
| - --> $DIR/cast_abs_to_unsigned.rs:19:13 |
| 46 | + --> $DIR/cast_abs_to_unsigned.rs:21:13 |
47 | 47 | |
|
48 | 48 | LL | let _ = a.abs() as u32;
|
49 | 49 | | ^^^^^^^ help: replace with: `a.unsigned_abs()`
|
50 | 50 |
|
51 | 51 | error: casting the result of `i64::abs()` to u64
|
52 |
| - --> $DIR/cast_abs_to_unsigned.rs:20:13 |
| 52 | + --> $DIR/cast_abs_to_unsigned.rs:22:13 |
53 | 53 | |
|
54 | 54 | LL | let _ = a.abs() as u64;
|
55 | 55 | | ^^^^^^^^^^^^^^ help: replace with: `a.unsigned_abs()`
|
56 | 56 |
|
57 | 57 | error: casting the result of `i64::abs()` to u128
|
58 |
| - --> $DIR/cast_abs_to_unsigned.rs:21:13 |
| 58 | + --> $DIR/cast_abs_to_unsigned.rs:23:13 |
59 | 59 | |
|
60 | 60 | LL | let _ = a.abs() as u128;
|
61 | 61 | | ^^^^^^^ help: replace with: `a.unsigned_abs()`
|
62 | 62 |
|
63 | 63 | error: casting the result of `isize::abs()` to usize
|
64 |
| - --> $DIR/cast_abs_to_unsigned.rs:24:13 |
| 64 | + --> $DIR/cast_abs_to_unsigned.rs:26:13 |
65 | 65 | |
|
66 | 66 | LL | let _ = a.abs() as usize;
|
67 | 67 | | ^^^^^^^^^^^^^^^^ help: replace with: `a.unsigned_abs()`
|
68 | 68 |
|
69 | 69 | error: casting the result of `isize::abs()` to u8
|
70 |
| - --> $DIR/cast_abs_to_unsigned.rs:25:13 |
| 70 | + --> $DIR/cast_abs_to_unsigned.rs:27:13 |
71 | 71 | |
|
72 | 72 | LL | let _ = a.abs() as u8;
|
73 | 73 | | ^^^^^^^ help: replace with: `a.unsigned_abs()`
|
74 | 74 |
|
75 | 75 | error: casting the result of `isize::abs()` to u16
|
76 |
| - --> $DIR/cast_abs_to_unsigned.rs:26:13 |
| 76 | + --> $DIR/cast_abs_to_unsigned.rs:28:13 |
77 | 77 | |
|
78 | 78 | LL | let _ = a.abs() as u16;
|
79 | 79 | | ^^^^^^^ help: replace with: `a.unsigned_abs()`
|
80 | 80 |
|
81 | 81 | error: casting the result of `isize::abs()` to u32
|
82 |
| - --> $DIR/cast_abs_to_unsigned.rs:27:13 |
| 82 | + --> $DIR/cast_abs_to_unsigned.rs:29:13 |
83 | 83 | |
|
84 | 84 | LL | let _ = a.abs() as u32;
|
85 | 85 | | ^^^^^^^ help: replace with: `a.unsigned_abs()`
|
86 | 86 |
|
87 | 87 | error: casting the result of `isize::abs()` to u64
|
88 |
| - --> $DIR/cast_abs_to_unsigned.rs:28:13 |
| 88 | + --> $DIR/cast_abs_to_unsigned.rs:30:13 |
89 | 89 | |
|
90 | 90 | LL | let _ = a.abs() as u64;
|
91 | 91 | | ^^^^^^^ help: replace with: `a.unsigned_abs()`
|
92 | 92 |
|
93 | 93 | error: casting the result of `isize::abs()` to u128
|
94 |
| - --> $DIR/cast_abs_to_unsigned.rs:29:13 |
| 94 | + --> $DIR/cast_abs_to_unsigned.rs:31:13 |
95 | 95 | |
|
96 | 96 | LL | let _ = a.abs() as u128;
|
97 | 97 | | ^^^^^^^ help: replace with: `a.unsigned_abs()`
|
98 | 98 |
|
99 | 99 | error: casting the result of `i64::abs()` to u32
|
100 |
| - --> $DIR/cast_abs_to_unsigned.rs:31:13 |
| 100 | + --> $DIR/cast_abs_to_unsigned.rs:33:13 |
101 | 101 | |
|
102 | 102 | LL | let _ = (x as i64 - y as i64).abs() as u32;
|
103 | 103 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `(x as i64 - y as i64).unsigned_abs()`
|
104 | 104 |
|
105 |
| -error: aborting due to 17 previous errors |
| 105 | +error: casting the result of `i32::abs()` to u32 |
| 106 | + --> $DIR/cast_abs_to_unsigned.rs:47:23 |
| 107 | + | |
| 108 | +LL | assert_eq!(10u32, x.abs() as u32); |
| 109 | + | ^^^^^^^^^^^^^^ help: replace with: `x.unsigned_abs()` |
| 110 | + |
| 111 | +error: aborting due to 18 previous errors |
106 | 112 |
|
0 commit comments