Skip to content

Commit 802a6d3

Browse files
committed
run-rustfix for unseparated-prefix-literals
1 parent c8fb621 commit 802a6d3

File tree

3 files changed

+86
-0
lines changed

3 files changed

+86
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// run-rustfix
2+
3+
#![warn(clippy::unseparated_literal_suffix)]
4+
#![allow(dead_code)]
5+
6+
fn main() {
7+
let _ok1 = 1234_i32;
8+
let _ok2 = 1234_isize;
9+
let _ok3 = 0x123_isize;
10+
let _fail1 = 1234_i32;
11+
let _fail2 = 1234_u32;
12+
let _fail3 = 1234_isize;
13+
let _fail4 = 1234_usize;
14+
let _fail5 = 0x123_isize;
15+
16+
let _okf1 = 1.5_f32;
17+
let _okf2 = 1_f32;
18+
let _failf1 = 1.5_f32;
19+
let _failf2 = 1_f32;
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// run-rustfix
2+
3+
#![warn(clippy::unseparated_literal_suffix)]
4+
#![allow(dead_code)]
5+
6+
fn main() {
7+
let _ok1 = 1234_i32;
8+
let _ok2 = 1234_isize;
9+
let _ok3 = 0x123_isize;
10+
let _fail1 = 1234i32;
11+
let _fail2 = 1234u32;
12+
let _fail3 = 1234isize;
13+
let _fail4 = 1234usize;
14+
let _fail5 = 0x123isize;
15+
16+
let _okf1 = 1.5_f32;
17+
let _okf2 = 1_f32;
18+
let _failf1 = 1.5f32;
19+
let _failf2 = 1f32;
20+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
error: integer type suffix should be separated by an underscore
2+
--> $DIR/unseparated_prefix_literals.rs:10:18
3+
|
4+
LL | let _fail1 = 1234i32;
5+
| ^^^^^^^ help: add an underscore: `1234_i32`
6+
|
7+
= note: `-D clippy::unseparated-literal-suffix` implied by `-D warnings`
8+
9+
error: integer type suffix should be separated by an underscore
10+
--> $DIR/unseparated_prefix_literals.rs:11:18
11+
|
12+
LL | let _fail2 = 1234u32;
13+
| ^^^^^^^ help: add an underscore: `1234_u32`
14+
15+
error: integer type suffix should be separated by an underscore
16+
--> $DIR/unseparated_prefix_literals.rs:12:18
17+
|
18+
LL | let _fail3 = 1234isize;
19+
| ^^^^^^^^^ help: add an underscore: `1234_isize`
20+
21+
error: integer type suffix should be separated by an underscore
22+
--> $DIR/unseparated_prefix_literals.rs:13:18
23+
|
24+
LL | let _fail4 = 1234usize;
25+
| ^^^^^^^^^ help: add an underscore: `1234_usize`
26+
27+
error: integer type suffix should be separated by an underscore
28+
--> $DIR/unseparated_prefix_literals.rs:14:18
29+
|
30+
LL | let _fail5 = 0x123isize;
31+
| ^^^^^^^^^^ help: add an underscore: `0x123_isize`
32+
33+
error: float type suffix should be separated by an underscore
34+
--> $DIR/unseparated_prefix_literals.rs:18:19
35+
|
36+
LL | let _failf1 = 1.5f32;
37+
| ^^^^^^ help: add an underscore: `1.5_f32`
38+
39+
error: float type suffix should be separated by an underscore
40+
--> $DIR/unseparated_prefix_literals.rs:19:19
41+
|
42+
LL | let _failf2 = 1f32;
43+
| ^^^^ help: add an underscore: `1_f32`
44+
45+
error: aborting due to 7 previous errors
46+

0 commit comments

Comments
 (0)