Add run-rustfix for types test

This commit is contained in:
Wilco Kusee 2019-01-13 19:57:19 +01:00
parent d3c452265f
commit 67be42143a
3 changed files with 19 additions and 1 deletions

14
tests/ui/types.fixed Normal file
View 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);
}

View File

@ -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;

View File

@ -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)`