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