Skip to content

Commit 184c971

Browse files
committed
Fix 32bit tests
1 parent 25e8639 commit 184c971

6 files changed

+332
-45
lines changed

tests/ui/cast_size.32bit.stderr

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ LL | 1isize as i8;
66
|
77
= help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
88
= note: `-D clippy::cast-possible-truncation` implied by `-D warnings`
9+
= help: to override `-D warnings` add `#[allow(clippy::cast_possible_truncation)]`
910
help: ... or use `try_from` and handle the error accordingly
1011
|
1112
LL | i8::try_from(1isize);
@@ -18,6 +19,7 @@ LL | x0 as f64;
1819
| ^^^^^^^^^
1920
|
2021
= note: `-D clippy::cast-precision-loss` implied by `-D warnings`
22+
= help: to override `-D warnings` add `#[allow(clippy::cast_precision_loss)]`
2123

2224
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)
2325
--> $DIR/cast_size.rs:19:5
@@ -92,6 +94,7 @@ LL | 1usize as i32;
9294
| ^^^^^^^^^^^^^
9395
|
9496
= note: `-D clippy::cast-possible-wrap` implied by `-D warnings`
97+
= help: to override `-D warnings` add `#[allow(clippy::cast_possible_wrap)]`
9598

9699
error: casting `i64` to `isize` may truncate the value on targets with 32-bit wide pointers
97100
--> $DIR/cast_size.rs:26:5

tests/ui/fn_to_numeric_cast.32bit.stderr

+25-23
Original file line numberDiff line numberDiff line change
@@ -1,141 +1,143 @@
11
error: casting function pointer `foo` to `i8`, which truncates the value
2-
--> $DIR/fn_to_numeric_cast.rs:11:13
2+
--> $DIR/fn_to_numeric_cast.rs:10:13
33
|
44
LL | let _ = foo as i8;
55
| ^^^^^^^^^ help: try: `foo as usize`
66
|
77
= note: `-D clippy::fn-to-numeric-cast-with-truncation` implied by `-D warnings`
8+
= help: to override `-D warnings` add `#[allow(clippy::fn_to_numeric_cast_with_truncation)]`
89

910
error: casting function pointer `foo` to `i16`, which truncates the value
10-
--> $DIR/fn_to_numeric_cast.rs:12:13
11+
--> $DIR/fn_to_numeric_cast.rs:11:13
1112
|
1213
LL | let _ = foo as i16;
1314
| ^^^^^^^^^^ help: try: `foo as usize`
1415

1516
error: casting function pointer `foo` to `i32`
16-
--> $DIR/fn_to_numeric_cast.rs:13:13
17+
--> $DIR/fn_to_numeric_cast.rs:12:13
1718
|
1819
LL | let _ = foo as i32;
1920
| ^^^^^^^^^^ help: try: `foo as usize`
2021
|
2122
= note: `-D clippy::fn-to-numeric-cast` implied by `-D warnings`
23+
= help: to override `-D warnings` add `#[allow(clippy::fn_to_numeric_cast)]`
2224

2325
error: casting function pointer `foo` to `i64`
24-
--> $DIR/fn_to_numeric_cast.rs:14:13
26+
--> $DIR/fn_to_numeric_cast.rs:13:13
2527
|
2628
LL | let _ = foo as i64;
2729
| ^^^^^^^^^^ help: try: `foo as usize`
2830

2931
error: casting function pointer `foo` to `i128`
30-
--> $DIR/fn_to_numeric_cast.rs:15:13
32+
--> $DIR/fn_to_numeric_cast.rs:14:13
3133
|
3234
LL | let _ = foo as i128;
3335
| ^^^^^^^^^^^ help: try: `foo as usize`
3436

3537
error: casting function pointer `foo` to `isize`
36-
--> $DIR/fn_to_numeric_cast.rs:16:13
38+
--> $DIR/fn_to_numeric_cast.rs:15:13
3739
|
3840
LL | let _ = foo as isize;
3941
| ^^^^^^^^^^^^ help: try: `foo as usize`
4042

4143
error: casting function pointer `foo` to `u8`, which truncates the value
42-
--> $DIR/fn_to_numeric_cast.rs:18:13
44+
--> $DIR/fn_to_numeric_cast.rs:17:13
4345
|
4446
LL | let _ = foo as u8;
4547
| ^^^^^^^^^ help: try: `foo as usize`
4648

4749
error: casting function pointer `foo` to `u16`, which truncates the value
48-
--> $DIR/fn_to_numeric_cast.rs:19:13
50+
--> $DIR/fn_to_numeric_cast.rs:18:13
4951
|
5052
LL | let _ = foo as u16;
5153
| ^^^^^^^^^^ help: try: `foo as usize`
5254

5355
error: casting function pointer `foo` to `u32`
54-
--> $DIR/fn_to_numeric_cast.rs:20:13
56+
--> $DIR/fn_to_numeric_cast.rs:19:13
5557
|
5658
LL | let _ = foo as u32;
5759
| ^^^^^^^^^^ help: try: `foo as usize`
5860

5961
error: casting function pointer `foo` to `u64`
60-
--> $DIR/fn_to_numeric_cast.rs:21:13
62+
--> $DIR/fn_to_numeric_cast.rs:20:13
6163
|
6264
LL | let _ = foo as u64;
6365
| ^^^^^^^^^^ help: try: `foo as usize`
6466

6567
error: casting function pointer `foo` to `u128`
66-
--> $DIR/fn_to_numeric_cast.rs:22:13
68+
--> $DIR/fn_to_numeric_cast.rs:21:13
6769
|
6870
LL | let _ = foo as u128;
6971
| ^^^^^^^^^^^ help: try: `foo as usize`
7072

7173
error: casting function pointer `abc` to `i8`, which truncates the value
72-
--> $DIR/fn_to_numeric_cast.rs:35:13
74+
--> $DIR/fn_to_numeric_cast.rs:34:13
7375
|
7476
LL | let _ = abc as i8;
7577
| ^^^^^^^^^ help: try: `abc as usize`
7678

7779
error: casting function pointer `abc` to `i16`, which truncates the value
78-
--> $DIR/fn_to_numeric_cast.rs:36:13
80+
--> $DIR/fn_to_numeric_cast.rs:35:13
7981
|
8082
LL | let _ = abc as i16;
8183
| ^^^^^^^^^^ help: try: `abc as usize`
8284

8385
error: casting function pointer `abc` to `i32`
84-
--> $DIR/fn_to_numeric_cast.rs:37:13
86+
--> $DIR/fn_to_numeric_cast.rs:36:13
8587
|
8688
LL | let _ = abc as i32;
8789
| ^^^^^^^^^^ help: try: `abc as usize`
8890

8991
error: casting function pointer `abc` to `i64`
90-
--> $DIR/fn_to_numeric_cast.rs:38:13
92+
--> $DIR/fn_to_numeric_cast.rs:37:13
9193
|
9294
LL | let _ = abc as i64;
9395
| ^^^^^^^^^^ help: try: `abc as usize`
9496

9597
error: casting function pointer `abc` to `i128`
96-
--> $DIR/fn_to_numeric_cast.rs:39:13
98+
--> $DIR/fn_to_numeric_cast.rs:38:13
9799
|
98100
LL | let _ = abc as i128;
99101
| ^^^^^^^^^^^ help: try: `abc as usize`
100102

101103
error: casting function pointer `abc` to `isize`
102-
--> $DIR/fn_to_numeric_cast.rs:40:13
104+
--> $DIR/fn_to_numeric_cast.rs:39:13
103105
|
104106
LL | let _ = abc as isize;
105107
| ^^^^^^^^^^^^ help: try: `abc as usize`
106108

107109
error: casting function pointer `abc` to `u8`, which truncates the value
108-
--> $DIR/fn_to_numeric_cast.rs:42:13
110+
--> $DIR/fn_to_numeric_cast.rs:41:13
109111
|
110112
LL | let _ = abc as u8;
111113
| ^^^^^^^^^ help: try: `abc as usize`
112114

113115
error: casting function pointer `abc` to `u16`, which truncates the value
114-
--> $DIR/fn_to_numeric_cast.rs:43:13
116+
--> $DIR/fn_to_numeric_cast.rs:42:13
115117
|
116118
LL | let _ = abc as u16;
117119
| ^^^^^^^^^^ help: try: `abc as usize`
118120

119121
error: casting function pointer `abc` to `u32`
120-
--> $DIR/fn_to_numeric_cast.rs:44:13
122+
--> $DIR/fn_to_numeric_cast.rs:43:13
121123
|
122124
LL | let _ = abc as u32;
123125
| ^^^^^^^^^^ help: try: `abc as usize`
124126

125127
error: casting function pointer `abc` to `u64`
126-
--> $DIR/fn_to_numeric_cast.rs:45:13
128+
--> $DIR/fn_to_numeric_cast.rs:44:13
127129
|
128130
LL | let _ = abc as u64;
129131
| ^^^^^^^^^^ help: try: `abc as usize`
130132

131133
error: casting function pointer `abc` to `u128`
132-
--> $DIR/fn_to_numeric_cast.rs:46:13
134+
--> $DIR/fn_to_numeric_cast.rs:45:13
133135
|
134136
LL | let _ = abc as u128;
135137
| ^^^^^^^^^^^ help: try: `abc as usize`
136138

137139
error: casting function pointer `f` to `i32`
138-
--> $DIR/fn_to_numeric_cast.rs:53:5
140+
--> $DIR/fn_to_numeric_cast.rs:52:5
139141
|
140142
LL | f as i32
141143
| ^^^^^^^^ help: try: `f as usize`

0 commit comments

Comments
 (0)