Add tests for FP in nonstandard_macro_braces

This commit is contained in:
Devin Ragotzy 2021-07-21 07:28:52 -04:00
parent fb9b13a69f
commit 5bc5bfce04
3 changed files with 36 additions and 13 deletions

View File

@ -3,4 +3,5 @@ standard-macro-braces = [
{ name = "quote::quote", brace = "{" }, { name = "quote::quote", brace = "{" },
{ name = "eprint", brace = "[" }, { name = "eprint", brace = "[" },
{ name = "type_pos", brace = "[" }, { name = "type_pos", brace = "[" },
{ name = "printlnfoo", brace = "[" },
] ]

View File

@ -32,6 +32,12 @@ macro_rules! type_pos {
}; };
} }
macro_rules! printlnfoo {
($thing:expr) => {
println!("hey {}", $thing)
};
}
#[rustfmt::skip] #[rustfmt::skip]
fn main() { fn main() {
let _ = vec! {1, 2, 3}; let _ = vec! {1, 2, 3};
@ -49,4 +55,8 @@ fn main() {
let _: type_pos!(usize) = vec![]; let _: type_pos!(usize) = vec![];
eprint!("test if user config overrides defaults"); eprint!("test if user config overrides defaults");
println!("test if println triggers for printlnfoo");
printlnfoo!("you");
} }

View File

@ -1,48 +1,48 @@
error: use of irregular braces for `vec!` macro error: use of irregular braces for `vec!` macro
--> $DIR/conf_nonstandard_macro_braces.rs:37:13 --> $DIR/conf_nonstandard_macro_braces.rs:43:13
| |
LL | let _ = vec! {1, 2, 3}; LL | let _ = vec! {1, 2, 3};
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
| |
= note: `-D clippy::nonstandard-macro-braces` implied by `-D warnings` = note: `-D clippy::nonstandard-macro-braces` implied by `-D warnings`
help: consider writing `vec![1, 2, 3]` help: consider writing `vec![1, 2, 3]`
--> $DIR/conf_nonstandard_macro_braces.rs:37:13 --> $DIR/conf_nonstandard_macro_braces.rs:43:13
| |
LL | let _ = vec! {1, 2, 3}; LL | let _ = vec! {1, 2, 3};
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
error: use of irregular braces for `format!` macro error: use of irregular braces for `format!` macro
--> $DIR/conf_nonstandard_macro_braces.rs:38:13 --> $DIR/conf_nonstandard_macro_braces.rs:44:13
| |
LL | let _ = format!["ugh {} stop being such a good compiler", "hello"]; LL | let _ = format!["ugh {} stop being such a good compiler", "hello"];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
help: consider writing `format!("ugh () stop being such a good compiler", "hello")` help: consider writing `format!("ugh () stop being such a good compiler", "hello")`
--> $DIR/conf_nonstandard_macro_braces.rs:38:13 --> $DIR/conf_nonstandard_macro_braces.rs:44:13
| |
LL | let _ = format!["ugh {} stop being such a good compiler", "hello"]; LL | let _ = format!["ugh {} stop being such a good compiler", "hello"];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: use of irregular braces for `quote!` macro error: use of irregular braces for `quote!` macro
--> $DIR/conf_nonstandard_macro_braces.rs:39:13 --> $DIR/conf_nonstandard_macro_braces.rs:45:13
| |
LL | let _ = quote!(let x = 1;); LL | let _ = quote!(let x = 1;);
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
| |
help: consider writing `quote! {let x = 1;}` help: consider writing `quote! {let x = 1;}`
--> $DIR/conf_nonstandard_macro_braces.rs:39:13 --> $DIR/conf_nonstandard_macro_braces.rs:45:13
| |
LL | let _ = quote!(let x = 1;); LL | let _ = quote!(let x = 1;);
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
error: use of irregular braces for `quote::quote!` macro error: use of irregular braces for `quote::quote!` macro
--> $DIR/conf_nonstandard_macro_braces.rs:40:13 --> $DIR/conf_nonstandard_macro_braces.rs:46:13
| |
LL | let _ = quote::quote!(match match match); LL | let _ = quote::quote!(match match match);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
help: consider writing `quote::quote! {match match match}` help: consider writing `quote::quote! {match match match}`
--> $DIR/conf_nonstandard_macro_braces.rs:40:13 --> $DIR/conf_nonstandard_macro_braces.rs:46:13
| |
LL | let _ = quote::quote!(match match match); LL | let _ = quote::quote!(match match match);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -67,28 +67,40 @@ LL | let _ = test!();
= note: this error originates in the macro `test` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `test` (in Nightly builds, run with -Z macro-backtrace for more info)
error: use of irregular braces for `type_pos!` macro error: use of irregular braces for `type_pos!` macro
--> $DIR/conf_nonstandard_macro_braces.rs:49:12 --> $DIR/conf_nonstandard_macro_braces.rs:55:12
| |
LL | let _: type_pos!(usize) = vec![]; LL | let _: type_pos!(usize) = vec![];
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
| |
help: consider writing `type_pos![usize]` help: consider writing `type_pos![usize]`
--> $DIR/conf_nonstandard_macro_braces.rs:49:12 --> $DIR/conf_nonstandard_macro_braces.rs:55:12
| |
LL | let _: type_pos!(usize) = vec![]; LL | let _: type_pos!(usize) = vec![];
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
error: use of irregular braces for `eprint!` macro error: use of irregular braces for `eprint!` macro
--> $DIR/conf_nonstandard_macro_braces.rs:51:5 --> $DIR/conf_nonstandard_macro_braces.rs:57:5
| |
LL | eprint!("test if user config overrides defaults"); LL | eprint!("test if user config overrides defaults");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
help: consider writing `eprint!["test if user config overrides defaults"];` help: consider writing `eprint!["test if user config overrides defaults"];`
--> $DIR/conf_nonstandard_macro_braces.rs:51:5 --> $DIR/conf_nonstandard_macro_braces.rs:57:5
| |
LL | eprint!("test if user config overrides defaults"); LL | eprint!("test if user config overrides defaults");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 7 previous errors error: use of irregular braces for `printlnfoo!` macro
--> $DIR/conf_nonstandard_macro_braces.rs:61:5
|
LL | printlnfoo!("you");
| ^^^^^^^^^^^^^^^^^^^
|
help: consider writing `printlnfoo!["you"];`
--> $DIR/conf_nonstandard_macro_braces.rs:61:5
|
LL | printlnfoo!("you");
| ^^^^^^^^^^^^^^^^^^^
error: aborting due to 8 previous errors