Skip to content

Commit 0fcc2db

Browse files
samueltardieuGuillaumeGomez
authored andcommitted
Fix 32 bits tests
1 parent 211f79d commit 0fcc2db

File tree

3 files changed

+81
-63
lines changed

3 files changed

+81
-63
lines changed

tests/ui/cast_size.32bit.stderr

+18-18
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ LL | i8::try_from(1isize);
1313
| ~~~~~~~~~~~~~~~~~~~~
1414

1515
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)
16-
--> tests/ui/cast_size.rs:21:5
16+
--> tests/ui/cast_size.rs:22:5
1717
|
1818
LL | x0 as f32;
1919
| ^^^^^^^^^
@@ -22,25 +22,25 @@ LL | x0 as f32;
2222
= help: to override `-D warnings` add `#[allow(clippy::cast_precision_loss)]`
2323

2424
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)
25-
--> tests/ui/cast_size.rs:22:5
25+
--> tests/ui/cast_size.rs:24:5
2626
|
2727
LL | x1 as f32;
2828
| ^^^^^^^^^
2929

3030
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)
31-
--> tests/ui/cast_size.rs:23:5
31+
--> tests/ui/cast_size.rs:26:5
3232
|
3333
LL | x0 as f64;
3434
| ^^^^^^^^^
3535

3636
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)
37-
--> tests/ui/cast_size.rs:24:5
37+
--> tests/ui/cast_size.rs:28:5
3838
|
3939
LL | x1 as f64;
4040
| ^^^^^^^^^
4141

4242
error: casting `isize` to `i32` may truncate the value on targets with 64-bit wide pointers
43-
--> tests/ui/cast_size.rs:28:5
43+
--> tests/ui/cast_size.rs:33:5
4444
|
4545
LL | 1isize as i32;
4646
| ^^^^^^^^^^^^^
@@ -52,7 +52,7 @@ LL | i32::try_from(1isize);
5252
| ~~~~~~~~~~~~~~~~~~~~~
5353

5454
error: casting `isize` to `u32` may truncate the value on targets with 64-bit wide pointers
55-
--> tests/ui/cast_size.rs:29:5
55+
--> tests/ui/cast_size.rs:35:5
5656
|
5757
LL | 1isize as u32;
5858
| ^^^^^^^^^^^^^
@@ -64,7 +64,7 @@ LL | u32::try_from(1isize);
6464
| ~~~~~~~~~~~~~~~~~~~~~
6565

6666
error: casting `usize` to `u32` may truncate the value on targets with 64-bit wide pointers
67-
--> tests/ui/cast_size.rs:30:5
67+
--> tests/ui/cast_size.rs:37:5
6868
|
6969
LL | 1usize as u32;
7070
| ^^^^^^^^^^^^^
@@ -76,7 +76,7 @@ LL | u32::try_from(1usize);
7676
| ~~~~~~~~~~~~~~~~~~~~~
7777

7878
error: casting `usize` to `i32` may truncate the value on targets with 64-bit wide pointers
79-
--> tests/ui/cast_size.rs:31:5
79+
--> tests/ui/cast_size.rs:39:5
8080
|
8181
LL | 1usize as i32;
8282
| ^^^^^^^^^^^^^
@@ -88,7 +88,7 @@ LL | i32::try_from(1usize);
8888
| ~~~~~~~~~~~~~~~~~~~~~
8989

9090
error: casting `usize` to `i32` may wrap around the value on targets with 32-bit wide pointers
91-
--> tests/ui/cast_size.rs:31:5
91+
--> tests/ui/cast_size.rs:39:5
9292
|
9393
LL | 1usize as i32;
9494
| ^^^^^^^^^^^^^
@@ -97,7 +97,7 @@ LL | 1usize as i32;
9797
= help: to override `-D warnings` add `#[allow(clippy::cast_possible_wrap)]`
9898

9999
error: casting `i64` to `isize` may truncate the value on targets with 32-bit wide pointers
100-
--> tests/ui/cast_size.rs:32:5
100+
--> tests/ui/cast_size.rs:42:5
101101
|
102102
LL | 1i64 as isize;
103103
| ^^^^^^^^^^^^^
@@ -109,7 +109,7 @@ LL | isize::try_from(1i64);
109109
| ~~~~~~~~~~~~~~~~~~~~~
110110

111111
error: casting `i64` to `usize` may truncate the value on targets with 32-bit wide pointers
112-
--> tests/ui/cast_size.rs:33:5
112+
--> tests/ui/cast_size.rs:44:5
113113
|
114114
LL | 1i64 as usize;
115115
| ^^^^^^^^^^^^^
@@ -121,7 +121,7 @@ LL | usize::try_from(1i64);
121121
| ~~~~~~~~~~~~~~~~~~~~~
122122

123123
error: casting `u64` to `isize` may truncate the value on targets with 32-bit wide pointers
124-
--> tests/ui/cast_size.rs:34:5
124+
--> tests/ui/cast_size.rs:46:5
125125
|
126126
LL | 1u64 as isize;
127127
| ^^^^^^^^^^^^^
@@ -133,13 +133,13 @@ LL | isize::try_from(1u64);
133133
| ~~~~~~~~~~~~~~~~~~~~~
134134

135135
error: casting `u64` to `isize` may wrap around the value on targets with 64-bit wide pointers
136-
--> tests/ui/cast_size.rs:34:5
136+
--> tests/ui/cast_size.rs:46:5
137137
|
138138
LL | 1u64 as isize;
139139
| ^^^^^^^^^^^^^
140140

141141
error: casting `u64` to `usize` may truncate the value on targets with 32-bit wide pointers
142-
--> tests/ui/cast_size.rs:35:5
142+
--> tests/ui/cast_size.rs:49:5
143143
|
144144
LL | 1u64 as usize;
145145
| ^^^^^^^^^^^^^
@@ -151,25 +151,25 @@ LL | usize::try_from(1u64);
151151
| ~~~~~~~~~~~~~~~~~~~~~
152152

153153
error: casting `u32` to `isize` may wrap around the value on targets with 32-bit wide pointers
154-
--> tests/ui/cast_size.rs:36:5
154+
--> tests/ui/cast_size.rs:51:5
155155
|
156156
LL | 1u32 as isize;
157157
| ^^^^^^^^^^^^^
158158

159159
error: casting `i32` to `f32` causes a loss of precision (`i32` is 32 bits wide, but `f32`'s mantissa is only 23 bits wide)
160-
--> tests/ui/cast_size.rs:43:5
160+
--> tests/ui/cast_size.rs:59:5
161161
|
162162
LL | 999_999_999 as f32;
163163
| ^^^^^^^^^^^^^^^^^^
164164

165165
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)
166-
--> tests/ui/cast_size.rs:44:5
166+
--> tests/ui/cast_size.rs:61:5
167167
|
168168
LL | 9_999_999_999_999_999usize as f64;
169169
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
170170

171171
error: literal out of range for `usize`
172-
--> tests/ui/cast_size.rs:44:5
172+
--> tests/ui/cast_size.rs:61:5
173173
|
174174
LL | 9_999_999_999_999_999usize as f64;
175175
| ^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/ui/fn_to_numeric_cast.32bit.stderr

+22-22
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ LL | let _ = foo as i8;
88
= help: to override `-D warnings` add `#[allow(clippy::fn_to_numeric_cast_with_truncation)]`
99

1010
error: casting function pointer `foo` to `i16`, which truncates the value
11-
--> tests/ui/fn_to_numeric_cast.rs:11:13
11+
--> tests/ui/fn_to_numeric_cast.rs:12:13
1212
|
1313
LL | let _ = foo as i16;
1414
| ^^^^^^^^^^ help: try: `foo as usize`
1515

1616
error: casting function pointer `foo` to `i32`
17-
--> tests/ui/fn_to_numeric_cast.rs:12:13
17+
--> tests/ui/fn_to_numeric_cast.rs:14:13
1818
|
1919
LL | let _ = foo as i32;
2020
| ^^^^^^^^^^ help: try: `foo as usize`
@@ -23,121 +23,121 @@ LL | let _ = foo as i32;
2323
= help: to override `-D warnings` add `#[allow(clippy::fn_to_numeric_cast)]`
2424

2525
error: casting function pointer `foo` to `i64`
26-
--> tests/ui/fn_to_numeric_cast.rs:13:13
26+
--> tests/ui/fn_to_numeric_cast.rs:16:13
2727
|
2828
LL | let _ = foo as i64;
2929
| ^^^^^^^^^^ help: try: `foo as usize`
3030

3131
error: casting function pointer `foo` to `i128`
32-
--> tests/ui/fn_to_numeric_cast.rs:14:13
32+
--> tests/ui/fn_to_numeric_cast.rs:18:13
3333
|
3434
LL | let _ = foo as i128;
3535
| ^^^^^^^^^^^ help: try: `foo as usize`
3636

3737
error: casting function pointer `foo` to `isize`
38-
--> tests/ui/fn_to_numeric_cast.rs:15:13
38+
--> tests/ui/fn_to_numeric_cast.rs:20:13
3939
|
4040
LL | let _ = foo as isize;
4141
| ^^^^^^^^^^^^ help: try: `foo as usize`
4242

4343
error: casting function pointer `foo` to `u8`, which truncates the value
44-
--> tests/ui/fn_to_numeric_cast.rs:17:13
44+
--> tests/ui/fn_to_numeric_cast.rs:23:13
4545
|
4646
LL | let _ = foo as u8;
4747
| ^^^^^^^^^ help: try: `foo as usize`
4848

4949
error: casting function pointer `foo` to `u16`, which truncates the value
50-
--> tests/ui/fn_to_numeric_cast.rs:18:13
50+
--> tests/ui/fn_to_numeric_cast.rs:25:13
5151
|
5252
LL | let _ = foo as u16;
5353
| ^^^^^^^^^^ help: try: `foo as usize`
5454

5555
error: casting function pointer `foo` to `u32`
56-
--> tests/ui/fn_to_numeric_cast.rs:19:13
56+
--> tests/ui/fn_to_numeric_cast.rs:27:13
5757
|
5858
LL | let _ = foo as u32;
5959
| ^^^^^^^^^^ help: try: `foo as usize`
6060

6161
error: casting function pointer `foo` to `u64`
62-
--> tests/ui/fn_to_numeric_cast.rs:20:13
62+
--> tests/ui/fn_to_numeric_cast.rs:29:13
6363
|
6464
LL | let _ = foo as u64;
6565
| ^^^^^^^^^^ help: try: `foo as usize`
6666

6767
error: casting function pointer `foo` to `u128`
68-
--> tests/ui/fn_to_numeric_cast.rs:21:13
68+
--> tests/ui/fn_to_numeric_cast.rs:31:13
6969
|
7070
LL | let _ = foo as u128;
7171
| ^^^^^^^^^^^ help: try: `foo as usize`
7272

7373
error: casting function pointer `abc` to `i8`, which truncates the value
74-
--> tests/ui/fn_to_numeric_cast.rs:34:13
74+
--> tests/ui/fn_to_numeric_cast.rs:45:13
7575
|
7676
LL | let _ = abc as i8;
7777
| ^^^^^^^^^ help: try: `abc as usize`
7878

7979
error: casting function pointer `abc` to `i16`, which truncates the value
80-
--> tests/ui/fn_to_numeric_cast.rs:35:13
80+
--> tests/ui/fn_to_numeric_cast.rs:47:13
8181
|
8282
LL | let _ = abc as i16;
8383
| ^^^^^^^^^^ help: try: `abc as usize`
8484

8585
error: casting function pointer `abc` to `i32`
86-
--> tests/ui/fn_to_numeric_cast.rs:36:13
86+
--> tests/ui/fn_to_numeric_cast.rs:49:13
8787
|
8888
LL | let _ = abc as i32;
8989
| ^^^^^^^^^^ help: try: `abc as usize`
9090

9191
error: casting function pointer `abc` to `i64`
92-
--> tests/ui/fn_to_numeric_cast.rs:37:13
92+
--> tests/ui/fn_to_numeric_cast.rs:51:13
9393
|
9494
LL | let _ = abc as i64;
9595
| ^^^^^^^^^^ help: try: `abc as usize`
9696

9797
error: casting function pointer `abc` to `i128`
98-
--> tests/ui/fn_to_numeric_cast.rs:38:13
98+
--> tests/ui/fn_to_numeric_cast.rs:53:13
9999
|
100100
LL | let _ = abc as i128;
101101
| ^^^^^^^^^^^ help: try: `abc as usize`
102102

103103
error: casting function pointer `abc` to `isize`
104-
--> tests/ui/fn_to_numeric_cast.rs:39:13
104+
--> tests/ui/fn_to_numeric_cast.rs:55:13
105105
|
106106
LL | let _ = abc as isize;
107107
| ^^^^^^^^^^^^ help: try: `abc as usize`
108108

109109
error: casting function pointer `abc` to `u8`, which truncates the value
110-
--> tests/ui/fn_to_numeric_cast.rs:41:13
110+
--> tests/ui/fn_to_numeric_cast.rs:58:13
111111
|
112112
LL | let _ = abc as u8;
113113
| ^^^^^^^^^ help: try: `abc as usize`
114114

115115
error: casting function pointer `abc` to `u16`, which truncates the value
116-
--> tests/ui/fn_to_numeric_cast.rs:42:13
116+
--> tests/ui/fn_to_numeric_cast.rs:60:13
117117
|
118118
LL | let _ = abc as u16;
119119
| ^^^^^^^^^^ help: try: `abc as usize`
120120

121121
error: casting function pointer `abc` to `u32`
122-
--> tests/ui/fn_to_numeric_cast.rs:43:13
122+
--> tests/ui/fn_to_numeric_cast.rs:62:13
123123
|
124124
LL | let _ = abc as u32;
125125
| ^^^^^^^^^^ help: try: `abc as usize`
126126

127127
error: casting function pointer `abc` to `u64`
128-
--> tests/ui/fn_to_numeric_cast.rs:44:13
128+
--> tests/ui/fn_to_numeric_cast.rs:64:13
129129
|
130130
LL | let _ = abc as u64;
131131
| ^^^^^^^^^^ help: try: `abc as usize`
132132

133133
error: casting function pointer `abc` to `u128`
134-
--> tests/ui/fn_to_numeric_cast.rs:45:13
134+
--> tests/ui/fn_to_numeric_cast.rs:66:13
135135
|
136136
LL | let _ = abc as u128;
137137
| ^^^^^^^^^^^ help: try: `abc as usize`
138138

139139
error: casting function pointer `f` to `i32`
140-
--> tests/ui/fn_to_numeric_cast.rs:52:5
140+
--> tests/ui/fn_to_numeric_cast.rs:74:5
141141
|
142142
LL | f as i32
143143
| ^^^^^^^^ help: try: `f as usize`

0 commit comments

Comments
 (0)