From f27372061a0effe3b00d400f4e577b9d9e0ad4c0 Mon Sep 17 00:00:00 2001 From: Akshay Date: Sat, 20 Nov 2021 18:57:28 +0530 Subject: add config option to fix and check --- lib/src/lib.rs | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'lib/src/lib.rs') diff --git a/lib/src/lib.rs b/lib/src/lib.rs index 5347666..d96d9eb 100644 --- a/lib/src/lib.rs +++ b/lib/src/lib.rs @@ -255,31 +255,24 @@ pub trait Lint: Metadata + Explain + Rule + Send + Sync {} /// /// See `lints.rs` for usage. #[macro_export] -macro_rules! lint_map { +macro_rules! lints { ($($s:ident),*,) => { - lint_map!($($s),*); + lints!($($s),*); }; ($($s:ident),*) => { - use ::std::collections::HashMap; - use ::rnix::SyntaxKind; $( mod $s; )* ::lazy_static::lazy_static! { - pub static ref LINTS: HashMap>> = { - let mut map = HashMap::new(); + pub static ref LINTS: Vec<&'static Box> = { + let mut v = Vec::new(); $( { let temp_lint = &*$s::LINT; - let temp_matches = temp_lint.match_kind(); - for temp_match in temp_matches { - map.entry(temp_match) - .and_modify(|v: &mut Vec<_>| v.push(temp_lint)) - .or_insert_with(|| vec![temp_lint]); - } + v.push(temp_lint); } )* - map + v }; } } -- cgit v1.2.3