Skip to content

Commit ca1c0aa

Browse files
committed
Add a regression test for proc-macro attribute
1 parent a5f4d3c commit ca1c0aa

File tree

4 files changed

+26
-9
lines changed

4 files changed

+26
-9
lines changed

mini-macro/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,8 @@ pub fn mini_macro(_: TokenStream) -> TokenStream {
1717
println!("{}", items[i]);
1818
}
1919
}
20+
fn line_wrapper() {
21+
println!("{}", line!());
22+
}
2023
)
2124
}

tests/ui/unseparated_prefix_literals.fixed

+7
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
#![warn(clippy::unseparated_literal_suffix)]
44
#![allow(dead_code)]
55

6+
#[macro_use]
7+
extern crate clippy_mini_macro_test;
8+
9+
// Test for proc-macro attribute
10+
#[derive(ClippyMiniMacroTest)]
11+
struct Foo;
12+
613
macro_rules! lit_from_macro {
714
() => {
815
42_usize

tests/ui/unseparated_prefix_literals.rs

+7
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
#![warn(clippy::unseparated_literal_suffix)]
44
#![allow(dead_code)]
55

6+
#[macro_use]
7+
extern crate clippy_mini_macro_test;
8+
9+
// Test for proc-macro attribute
10+
#[derive(ClippyMiniMacroTest)]
11+
struct Foo;
12+
613
macro_rules! lit_from_macro {
714
() => {
815
42usize

tests/ui/unseparated_prefix_literals.stderr

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,49 @@
11
error: integer type suffix should be separated by an underscore
2-
--> $DIR/unseparated_prefix_literals.rs:16:18
2+
--> $DIR/unseparated_prefix_literals.rs:23:18
33
|
44
LL | let _fail1 = 1234i32;
55
| ^^^^^^^ help: add an underscore: `1234_i32`
66
|
77
= note: `-D clippy::unseparated-literal-suffix` implied by `-D warnings`
88

99
error: integer type suffix should be separated by an underscore
10-
--> $DIR/unseparated_prefix_literals.rs:17:18
10+
--> $DIR/unseparated_prefix_literals.rs:24:18
1111
|
1212
LL | let _fail2 = 1234u32;
1313
| ^^^^^^^ help: add an underscore: `1234_u32`
1414

1515
error: integer type suffix should be separated by an underscore
16-
--> $DIR/unseparated_prefix_literals.rs:18:18
16+
--> $DIR/unseparated_prefix_literals.rs:25:18
1717
|
1818
LL | let _fail3 = 1234isize;
1919
| ^^^^^^^^^ help: add an underscore: `1234_isize`
2020

2121
error: integer type suffix should be separated by an underscore
22-
--> $DIR/unseparated_prefix_literals.rs:19:18
22+
--> $DIR/unseparated_prefix_literals.rs:26:18
2323
|
2424
LL | let _fail4 = 1234usize;
2525
| ^^^^^^^^^ help: add an underscore: `1234_usize`
2626

2727
error: integer type suffix should be separated by an underscore
28-
--> $DIR/unseparated_prefix_literals.rs:20:18
28+
--> $DIR/unseparated_prefix_literals.rs:27:18
2929
|
3030
LL | let _fail5 = 0x123isize;
3131
| ^^^^^^^^^^ help: add an underscore: `0x123_isize`
3232

3333
error: float type suffix should be separated by an underscore
34-
--> $DIR/unseparated_prefix_literals.rs:24:19
34+
--> $DIR/unseparated_prefix_literals.rs:31:19
3535
|
3636
LL | let _failf1 = 1.5f32;
3737
| ^^^^^^ help: add an underscore: `1.5_f32`
3838

3939
error: float type suffix should be separated by an underscore
40-
--> $DIR/unseparated_prefix_literals.rs:25:19
40+
--> $DIR/unseparated_prefix_literals.rs:32:19
4141
|
4242
LL | let _failf2 = 1f32;
4343
| ^^^^ help: add an underscore: `1_f32`
4444

4545
error: integer type suffix should be separated by an underscore
46-
--> $DIR/unseparated_prefix_literals.rs:8:9
46+
--> $DIR/unseparated_prefix_literals.rs:15:9
4747
|
4848
LL | 42usize
4949
| ^^^^^^^ help: add an underscore: `42_usize`
@@ -52,7 +52,7 @@ LL | let _ = lit_from_macro!();
5252
| ----------------- in this macro invocation
5353

5454
error: integer type suffix should be separated by an underscore
55-
--> $DIR/unseparated_prefix_literals.rs:33:16
55+
--> $DIR/unseparated_prefix_literals.rs:40:16
5656
|
5757
LL | assert_eq!(4897u32, 32223);
5858
| ^^^^^^^ help: add an underscore: `4897_u32`

0 commit comments

Comments
 (0)