aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAkshay <[email protected]>2021-11-20 13:27:28 +0000
committerAkshay <[email protected]>2021-11-20 13:27:28 +0000
commitf27372061a0effe3b00d400f4e577b9d9e0ad4c0 (patch)
treeedb9a9644a7ce6e8c28e937cdc5e4d62d45b4cb3 /lib
parenta5c3e679b06536bb43085b1a978854a73274af10 (diff)
add config option to fix and check
Diffstat (limited to 'lib')
-rw-r--r--lib/src/lib.rs19
1 files changed, 6 insertions, 13 deletions
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 {}
255/// 255///
256/// See `lints.rs` for usage. 256/// See `lints.rs` for usage.
257#[macro_export] 257#[macro_export]
258macro_rules! lint_map { 258macro_rules! lints {
259 ($($s:ident),*,) => { 259 ($($s:ident),*,) => {
260 lint_map!($($s),*); 260 lints!($($s),*);
261 }; 261 };
262 ($($s:ident),*) => { 262 ($($s:ident),*) => {
263 use ::std::collections::HashMap;
264 use ::rnix::SyntaxKind;
265 $( 263 $(
266 mod $s; 264 mod $s;
267 )* 265 )*
268 ::lazy_static::lazy_static! { 266 ::lazy_static::lazy_static! {
269 pub static ref LINTS: HashMap<SyntaxKind, Vec<&'static Box<dyn $crate::Lint>>> = { 267 pub static ref LINTS: Vec<&'static Box<dyn $crate::Lint>> = {
270 let mut map = HashMap::new(); 268 let mut v = Vec::new();
271 $( 269 $(
272 { 270 {
273 let temp_lint = &*$s::LINT; 271 let temp_lint = &*$s::LINT;
274 let temp_matches = temp_lint.match_kind(); 272 v.push(temp_lint);
275 for temp_match in temp_matches {
276 map.entry(temp_match)
277 .and_modify(|v: &mut Vec<_>| v.push(temp_lint))
278 .or_insert_with(|| vec![temp_lint]);
279 }
280 } 273 }
281 )* 274 )*
282 map 275 v
283 }; 276 };
284 } 277 }
285 } 278 }