aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorAkshay <[email protected]>2021-10-28 03:20:36 +0100
committerAkshay <[email protected]>2021-10-28 03:20:36 +0100
commit3c9a675b9d776bf2210803d582e9af88f9df2631 (patch)
tree6b3b88fe4040cc904922b4b084442dbcf20495ae /bin
parent8eccf15964e09c2e024710512e671c6b1b88e885 (diff)
fix fp with manual_inherit and manual_inherit_from
the lint also needed to validate if the length of the path component was exactly one, and not just check if the first component matches the value.
Diffstat (limited to 'bin')
-rw-r--r--bin/src/fix/single.rs16
-rw-r--r--bin/src/main.rs7
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 {