From a6d0a00ab078969c2123d133781451dfa8f586f4 Mon Sep 17 00:00:00 2001 From: WeblWabl Date: Sun, 11 Feb 2024 08:59:10 -0600 Subject: [PATCH] feat: Trailing comma error message (#655) * feat: adds macro check for trailing comma * feat: adds macro check for trailing comma * Update src/query.rs * feat: adds macro check for trailing comma --------- Co-authored-by: Predrag Gruevski <2348618+obi1kenobi@users.noreply.github.com> --- .gitignore | 1 + src/query.rs | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index b32f48c2..07d58fe0 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ localdata/ # Editor-local configuration .vscode/ +.idea # Unnecessary test data test_crates/**/Cargo.lock diff --git a/src/query.rs b/src/query.rs index 1e07fa13..4cffc1cf 100644 --- a/src/query.rs +++ b/src/query.rs @@ -444,7 +444,7 @@ mod tests { } macro_rules! add_lints { - ($($name:ident,)*) => { + ($($name:ident,)+) => { #[cfg(test)] mod tests_lints { $( @@ -462,6 +462,9 @@ macro_rules! add_lints { )* ] } + }; + ($($name:ident),*) => { + compile_error!("Please add a trailing comma after each lint identifier. This ensures our scripts like 'make_new_lint.sh' can safely edit invocations of this macro as needed."); } }