Skip to content

Commit 67be421

Browse files
committed
Add run-rustfix for types test
1 parent d3c4522 commit 67be421

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

Diff for: tests/ui/types.fixed

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// run-rustfix
2+
3+
#![allow(dead_code, unused_variables)]
4+
5+
// should not warn on lossy casting in constant types
6+
// because not supported yet
7+
const C: i32 = 42;
8+
const C_I64: i64 = C as i64;
9+
10+
fn main() {
11+
// should suggest i64::from(c)
12+
let c: i32 = 42;
13+
let c_i64: i64 = i64::from(c);
14+
}

Diff for: tests/ui/types.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// run-rustfix
2+
3+
#![allow(dead_code, unused_variables)]
4+
15
// should not warn on lossy casting in constant types
26
// because not supported yet
37
const C: i32 = 42;

Diff for: tests/ui/types.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: casting i32 to i64 may become silently lossy if types change
2-
--> $DIR/types.rs:9:22
2+
--> $DIR/types.rs:13:22
33
|
44
LL | let c_i64: i64 = c as i64;
55
| ^^^^^^^^ help: try: `i64::from(c)`

0 commit comments

Comments
 (0)