]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui-toml/nonstandard_macro_braces/conf_nonstandard_macro_braces.rs
Merge commit 'ac0e10aa68325235069a842f47499852b2dee79e' into clippyup
[rust.git] / src / tools / clippy / tests / ui-toml / nonstandard_macro_braces / conf_nonstandard_macro_braces.rs
1 // aux-build:proc_macro_derive.rs
2 // run-rustfix
3
4 #![warn(clippy::nonstandard_macro_braces)]
5
6 extern crate proc_macro_derive;
7 extern crate quote;
8
9 use quote::quote;
10
11 #[derive(proc_macro_derive::DeriveSomething)]
12 pub struct S;
13
14 proc_macro_derive::foo_bar!();
15
16 #[rustfmt::skip]
17 macro_rules! test {
18     () => {
19         vec!{0, 0, 0}
20     };
21 }
22
23 #[rustfmt::skip]
24 macro_rules! test2 {
25     ($($arg:tt)*) => {
26         format_args!($($arg)*)
27     };
28 }
29
30 macro_rules! type_pos {
31     ($what:ty) => {
32         Vec<$what>
33     };
34 }
35
36 macro_rules! printlnfoo {
37     ($thing:expr) => {
38         println!("{}", $thing)
39     };
40 }
41
42 #[rustfmt::skip]
43 fn main() {
44     let _ = vec! {1, 2, 3};
45     let _ = format!["ugh {} stop being such a good compiler", "hello"];
46     let _ = matches!{{}, ()};
47     let _ = quote!(let x = 1;);
48     let _ = quote::quote!(match match match);
49     let _ = test!(); // trigger when macro def is inside our own crate
50     let _ = vec![1,2,3];
51
52     let _ = quote::quote! {true || false};
53     let _ = vec! [0 ,0 ,0];
54     let _ = format!("fds{}fds", 10);
55     let _ = test2!["{}{}{}", 1, 2, 3];
56
57     let _: type_pos!(usize) = vec![];
58
59     eprint!("test if user config overrides defaults");
60
61     printlnfoo!["test if printlnfoo is triggered by println"];
62 }