]> git.lizzy.rs Git - rust.git/commitdiff
Add a regression test for proc-macro attribute
authorLzu Tao <taolzu@gmail.com>
Sat, 7 Sep 2019 03:53:34 +0000 (10:53 +0700)
committerLzu Tao <taolzu@gmail.com>
Mon, 9 Sep 2019 09:14:32 +0000 (16:14 +0700)
mini-macro/src/lib.rs
tests/ui/unseparated_prefix_literals.fixed
tests/ui/unseparated_prefix_literals.rs
tests/ui/unseparated_prefix_literals.stderr

index ddb40dace753f31a2d387ff2ec72b3d0e0e56714..60ffd94e733236a14c1e126d5e9923ebedba76a7 100644 (file)
@@ -17,5 +17,8 @@ fn needless_loop(items: &[u8]) {
                 println!("{}", items[i]);
             }
         }
+        fn line_wrapper() {
+            println!("{}", line!());
+        }
     )
 }
index 26bc47257b7954da284b8c58d1c08eb044dba9c3..3c422cc4fee72c5c8cfb2462e173cd88c84c40f7 100644 (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
index d710ccd1be2cd36ee546049ff2ef20f1e94b0984..09608661e0ef58585afbb94a1d2fdc1fa2c36fee 100644 (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
index 85f1881949eb72a1dc631f4709a45693ac9a7e46..d353d34fb3575d30c2ed56ca8ccfef7022953b7d 100644 (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`