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