aboutsummaryrefslogtreecommitdiff
path: root/bin/src/fix/single.rs
diff options
context:
space:
mode:
Diffstat (limited to 'bin/src/fix/single.rs')
-rw-r--r--bin/src/fix/single.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/bin/src/fix/single.rs b/bin/src/fix/single.rs
index b91dc45..d95cfda 100644
--- a/bin/src/fix/single.rs
+++ b/bin/src/fix/single.rs
@@ -1,10 +1,9 @@
1use std::{borrow::Cow, convert::TryFrom}; 1use std::{borrow::Cow, convert::TryFrom};
2 2
3use lib::{Report, LINTS}; 3use lib::Report;
4use rnix::{TextSize, WalkEvent}; 4use rnix::{TextSize, WalkEvent};
5 5
6use crate::err::SingleFixErr; 6use crate::{err::SingleFixErr, fix::Source, utils};
7use crate::fix::Source;
8 7
9pub struct SingleFixResult<'δ> { 8pub struct SingleFixResult<'δ> {
10 pub src: Source<'δ>, 9 pub src: Source<'δ>,
@@ -31,12 +30,13 @@ fn pos_to_byte(line: usize, col: usize, src: &str) -> Result<TextSize, SingleFix
31fn find(offset: TextSize, src: &str) -> Result<Report, SingleFixErr> { 30fn find(offset: TextSize, src: &str) -> Result<Report, SingleFixErr> {
32 // we don't really need the source to form a completely parsed tree 31 // we don't really need the source to form a completely parsed tree
33 let parsed = rnix::parse(src); 32 let parsed = rnix::parse(src);
33 let lints = utils::lint_map();
34 34
35 parsed 35 parsed
36 .node() 36 .node()
37 .preorder_with_tokens() 37 .preorder_with_tokens()
38 .filter_map(|event| match event { 38 .filter_map(|event| match event {
39 WalkEvent::Enter(child) => LINTS.get(&child.kind()).map(|rules| { 39 WalkEvent::Enter(child) => lints.get(&child.kind()).map(|rules| {
40 rules 40 rules
41 .iter() 41 .iter()
42 .filter_map(|rule| rule.validate(&child)) 42 .filter_map(|rule| rule.validate(&child))