diff options
Diffstat (limited to 'bin')
-rw-r--r-- | bin/src/fix/single.rs | 16 | ||||
-rw-r--r-- | bin/src/main.rs | 7 |
2 files changed, 13 insertions, 10 deletions
diff --git a/bin/src/fix/single.rs b/bin/src/fix/single.rs index 4d492f8..15a2ef4 100644 --- a/bin/src/fix/single.rs +++ b/bin/src/fix/single.rs | |||
@@ -36,15 +36,13 @@ fn find(offset: TextSize, src: &str) -> Result<Report, SingleFixErr> { | |||
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) => { | 39 | WalkEvent::Enter(child) => LINTS.get(&child.kind()).map(|rules| { |
40 | LINTS.get(&child.kind()).map(|rules| { | 40 | rules |
41 | rules | 41 | .iter() |
42 | .iter() | 42 | .filter_map(|rule| rule.validate(&child)) |
43 | .filter_map(|rule| rule.validate(&child)) | 43 | .filter(|report| report.total_suggestion_range().is_some()) |
44 | .filter(|report| report.total_suggestion_range().is_some()) | 44 | .next() |
45 | .next() | 45 | }), |
46 | }) | ||
47 | } | ||
48 | _ => None, | 46 | _ => None, |
49 | }) | 47 | }) |
50 | .flatten() | 48 | .flatten() |
diff --git a/bin/src/main.rs b/bin/src/main.rs index 9e9c8ac..c5d0626 100644 --- a/bin/src/main.rs +++ b/bin/src/main.rs | |||
@@ -60,7 +60,12 @@ fn _main() -> Result<(), StatixErr> { | |||
60 | let src = if let Some(path) = &single_config.target { | 60 | let src = if let Some(path) = &single_config.target { |
61 | std::fs::read_to_string(&path).map_err(SingleFixErr::InvalidPath)? | 61 | std::fs::read_to_string(&path).map_err(SingleFixErr::InvalidPath)? |
62 | } else { | 62 | } else { |
63 | io::stdin().lock().lines().map(|l| l.unwrap()).collect::<Vec<String>>().join("\n") | 63 | io::stdin() |
64 | .lock() | ||
65 | .lines() | ||
66 | .map(|l| l.unwrap()) | ||
67 | .collect::<Vec<String>>() | ||
68 | .join("\n") | ||
64 | }; | 69 | }; |
65 | 70 | ||
66 | let path_id = if let Some(path) = &single_config.target { | 71 | let path_id = if let Some(path) = &single_config.target { |