Skip to content

Commit cfa8776

Browse files
committed
Revert "Update unseparated_literal_suffix tests"
This reverts commit 33fb6782ce5056e33cce3bff74f803d2a521c51f.
1 parent 7e04a3d commit cfa8776

File tree

9 files changed

+147
-34
lines changed

9 files changed

+147
-34
lines changed

tests/ui-toml/separated_literal_suffix/clippy.toml

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/ui-toml/separated_literal_suffix/literal_suffix.rs

Lines changed: 0 additions & 6 deletions
This file was deleted.

tests/ui-toml/separated_literal_suffix/literal_suffix.stderr

Lines changed: 0 additions & 10 deletions
This file was deleted.

tests/ui-toml/unseparated_literal_suffix/clippy.toml

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/ui-toml/unseparated_literal_suffix/literal_suffix.rs

Lines changed: 0 additions & 6 deletions
This file was deleted.

tests/ui-toml/unseparated_literal_suffix/literal_suffix.stderr

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// run-rustfix
2+
// aux-build:proc_macro_derive.rs
3+
4+
#![warn(clippy::unseparated_literal_suffix)]
5+
#![allow(dead_code)]
6+
7+
#[macro_use]
8+
extern crate proc_macro_derive;
9+
10+
// Test for proc-macro attribute
11+
#[derive(ClippyMiniMacroTest)]
12+
struct Foo;
13+
14+
macro_rules! lit_from_macro {
15+
() => {
16+
42_usize
17+
};
18+
}
19+
20+
fn main() {
21+
let _ok1 = 1234_i32;
22+
let _ok2 = 1234_isize;
23+
let _ok3 = 0x123_isize;
24+
let _fail1 = 1234_i32;
25+
let _fail2 = 1234_u32;
26+
let _fail3 = 1234_isize;
27+
let _fail4 = 1234_usize;
28+
let _fail5 = 0x123_isize;
29+
30+
let _okf1 = 1.5_f32;
31+
let _okf2 = 1_f32;
32+
let _failf1 = 1.5_f32;
33+
let _failf2 = 1_f32;
34+
35+
// Test for macro
36+
let _ = lit_from_macro!();
37+
38+
// Counter example
39+
let _ = line!();
40+
// Because `assert!` contains `line!()` macro.
41+
assert_eq!(4897_u32, 32223);
42+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// run-rustfix
2+
// aux-build:proc_macro_derive.rs
3+
4+
#![warn(clippy::unseparated_literal_suffix)]
5+
#![allow(dead_code)]
6+
7+
#[macro_use]
8+
extern crate proc_macro_derive;
9+
10+
// Test for proc-macro attribute
11+
#[derive(ClippyMiniMacroTest)]
12+
struct Foo;
13+
14+
macro_rules! lit_from_macro {
15+
() => {
16+
42usize
17+
};
18+
}
19+
20+
fn main() {
21+
let _ok1 = 1234_i32;
22+
let _ok2 = 1234_isize;
23+
let _ok3 = 0x123_isize;
24+
let _fail1 = 1234i32;
25+
let _fail2 = 1234u32;
26+
let _fail3 = 1234isize;
27+
let _fail4 = 1234usize;
28+
let _fail5 = 0x123isize;
29+
30+
let _okf1 = 1.5_f32;
31+
let _okf2 = 1_f32;
32+
let _failf1 = 1.5f32;
33+
let _failf2 = 1f32;
34+
35+
// Test for macro
36+
let _ = lit_from_macro!();
37+
38+
// Counter example
39+
let _ = line!();
40+
// Because `assert!` contains `line!()` macro.
41+
assert_eq!(4897u32, 32223);
42+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
error: integer type suffix should be separated by an underscore
2+
--> $DIR/unseparated_prefix_literals.rs:24: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:25: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:26: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:27: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:28: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:32: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:33:19
41+
|
42+
LL | let _failf2 = 1f32;
43+
| ^^^^ help: add an underscore: `1_f32`
44+
45+
error: integer type suffix should be separated by an underscore
46+
--> $DIR/unseparated_prefix_literals.rs:16:9
47+
|
48+
LL | 42usize
49+
| ^^^^^^^ help: add an underscore: `42_usize`
50+
...
51+
LL | let _ = lit_from_macro!();
52+
| ----------------- in this macro invocation
53+
|
54+
= note: this error originates in the macro `lit_from_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
55+
56+
error: integer type suffix should be separated by an underscore
57+
--> $DIR/unseparated_prefix_literals.rs:41:16
58+
|
59+
LL | assert_eq!(4897u32, 32223);
60+
| ^^^^^^^ help: add an underscore: `4897_u32`
61+
62+
error: aborting due to 9 previous errors
63+

0 commit comments

Comments
 (0)