Add a regression test for proc-macro attribute

This commit is contained in:
Lzu Tao 2019-09-07 10:53:34 +07:00
parent a5f4d3ce29
commit ca1c0aa819
4 changed files with 26 additions and 9 deletions

View file

@ -17,5 +17,8 @@ pub fn mini_macro(_: TokenStream) -> TokenStream {
println!("{}", items[i]);
}
}
fn line_wrapper() {
println!("{}", line!());
}
)
}

View file

@ -3,6 +3,13 @@
#![warn(clippy::unseparated_literal_suffix)]
#![allow(dead_code)]
#[macro_use]
extern crate clippy_mini_macro_test;
// Test for proc-macro attribute
#[derive(ClippyMiniMacroTest)]
struct Foo;
macro_rules! lit_from_macro {
() => {
42_usize

View file

@ -3,6 +3,13 @@
#![warn(clippy::unseparated_literal_suffix)]
#![allow(dead_code)]
#[macro_use]
extern crate clippy_mini_macro_test;
// Test for proc-macro attribute
#[derive(ClippyMiniMacroTest)]
struct Foo;
macro_rules! lit_from_macro {
() => {
42usize

View file

@ -1,5 +1,5 @@
error: integer type suffix should be separated by an underscore
--> $DIR/unseparated_prefix_literals.rs:16:18
--> $DIR/unseparated_prefix_literals.rs:23:18
|
LL | let _fail1 = 1234i32;
| ^^^^^^^ help: add an underscore: `1234_i32`
@ -7,43 +7,43 @@ LL | let _fail1 = 1234i32;
= 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:17:18
--> $DIR/unseparated_prefix_literals.rs:24: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:18:18
--> $DIR/unseparated_prefix_literals.rs:25: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:19:18
--> $DIR/unseparated_prefix_literals.rs:26: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:20:18
--> $DIR/unseparated_prefix_literals.rs:27: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:24:19
--> $DIR/unseparated_prefix_literals.rs:31: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:25:19
--> $DIR/unseparated_prefix_literals.rs:32:19
|
LL | let _failf2 = 1f32;
| ^^^^ help: add an underscore: `1_f32`
error: integer type suffix should be separated by an underscore
--> $DIR/unseparated_prefix_literals.rs:8:9
--> $DIR/unseparated_prefix_literals.rs:15:9
|
LL | 42usize
| ^^^^^^^ help: add an underscore: `42_usize`
@ -52,7 +52,7 @@ LL | let _ = lit_from_macro!();
| ----------------- in this macro invocation
error: integer type suffix should be separated by an underscore
--> $DIR/unseparated_prefix_literals.rs:33:16
--> $DIR/unseparated_prefix_literals.rs:40:16
|
LL | assert_eq!(4897u32, 32223);
| ^^^^^^^ help: add an underscore: `4897_u32`