Add run-rustfix for types test
This commit is contained in:
parent
d3c452265f
commit
67be42143a
14
tests/ui/types.fixed
Normal file
14
tests/ui/types.fixed
Normal file
@ -0,0 +1,14 @@
|
||||
// run-rustfix
|
||||
|
||||
#![allow(dead_code, unused_variables)]
|
||||
|
||||
// should not warn on lossy casting in constant types
|
||||
// because not supported yet
|
||||
const C: i32 = 42;
|
||||
const C_I64: i64 = C as i64;
|
||||
|
||||
fn main() {
|
||||
// should suggest i64::from(c)
|
||||
let c: i32 = 42;
|
||||
let c_i64: i64 = i64::from(c);
|
||||
}
|
@ -1,3 +1,7 @@
|
||||
// run-rustfix
|
||||
|
||||
#![allow(dead_code, unused_variables)]
|
||||
|
||||
// should not warn on lossy casting in constant types
|
||||
// because not supported yet
|
||||
const C: i32 = 42;
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: casting i32 to i64 may become silently lossy if types change
|
||||
--> $DIR/types.rs:9:22
|
||||
--> $DIR/types.rs:13:22
|
||||
|
|
||||
LL | let c_i64: i64 = c as i64;
|
||||
| ^^^^^^^^ help: try: `i64::from(c)`
|
||||
|
Loading…
Reference in New Issue
Block a user