File tree Expand file tree Collapse file tree 3 files changed +19
-1
lines changed Expand file tree Collapse file tree 3 files changed +19
-1
lines changed Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change
1
+ // run-rustfix
2
+
3
+ #![ allow( dead_code, unused_variables) ]
4
+
1
5
// should not warn on lossy casting in constant types
2
6
// because not supported yet
3
7
const C : i32 = 42 ;
Original file line number Diff line number Diff line change 1
1
error: casting i32 to i64 may become silently lossy if types change
2
- --> $DIR/types.rs:9 :22
2
+ --> $DIR/types.rs:13 :22
3
3
|
4
4
LL | let c_i64: i64 = c as i64;
5
5
| ^^^^^^^^ help: try: `i64::from(c)`
You can’t perform that action at this time.
0 commit comments