run-rustfix for unseparated-prefix-literals

This commit is contained in:
Jamie McClymont 2019-08-19 02:52:59 +12:00
parent c8fb62148e
commit 802a6d33da
3 changed files with 86 additions and 0 deletions

View File

@ -0,0 +1,20 @@
// run-rustfix
#![warn(clippy::unseparated_literal_suffix)]
#![allow(dead_code)]
fn main() {
let _ok1 = 1234_i32;
let _ok2 = 1234_isize;
let _ok3 = 0x123_isize;
let _fail1 = 1234_i32;
let _fail2 = 1234_u32;
let _fail3 = 1234_isize;
let _fail4 = 1234_usize;
let _fail5 = 0x123_isize;
let _okf1 = 1.5_f32;
let _okf2 = 1_f32;
let _failf1 = 1.5_f32;
let _failf2 = 1_f32;
}

View File

@ -0,0 +1,20 @@
// run-rustfix
#![warn(clippy::unseparated_literal_suffix)]
#![allow(dead_code)]
fn main() {
let _ok1 = 1234_i32;
let _ok2 = 1234_isize;
let _ok3 = 0x123_isize;
let _fail1 = 1234i32;
let _fail2 = 1234u32;
let _fail3 = 1234isize;
let _fail4 = 1234usize;
let _fail5 = 0x123isize;
let _okf1 = 1.5_f32;
let _okf2 = 1_f32;
let _failf1 = 1.5f32;
let _failf2 = 1f32;
}

View File

@ -0,0 +1,46 @@
error: integer type suffix should be separated by an underscore
--> $DIR/unseparated_prefix_literals.rs:10:18
|
LL | let _fail1 = 1234i32;
| ^^^^^^^ help: add an underscore: `1234_i32`
|
= note: `-D clippy::unseparated-literal-suffix` implied by `-D warnings`
error: integer type suffix should be separated by an underscore
--> $DIR/unseparated_prefix_literals.rs:11:18
|
LL | let _fail2 = 1234u32;
| ^^^^^^^ help: add an underscore: `1234_u32`
error: integer type suffix should be separated by an underscore
--> $DIR/unseparated_prefix_literals.rs:12:18
|
LL | let _fail3 = 1234isize;
| ^^^^^^^^^ help: add an underscore: `1234_isize`
error: integer type suffix should be separated by an underscore
--> $DIR/unseparated_prefix_literals.rs:13:18
|
LL | let _fail4 = 1234usize;
| ^^^^^^^^^ help: add an underscore: `1234_usize`
error: integer type suffix should be separated by an underscore
--> $DIR/unseparated_prefix_literals.rs:14:18
|
LL | let _fail5 = 0x123isize;
| ^^^^^^^^^^ help: add an underscore: `0x123_isize`
error: float type suffix should be separated by an underscore
--> $DIR/unseparated_prefix_literals.rs:18:19
|
LL | let _failf1 = 1.5f32;
| ^^^^^^ help: add an underscore: `1.5_f32`
error: float type suffix should be separated by an underscore
--> $DIR/unseparated_prefix_literals.rs:19:19
|
LL | let _failf2 = 1f32;
| ^^^^ help: add an underscore: `1_f32`
error: aborting due to 7 previous errors