aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAkshay <[email protected]>2021-10-28 12:44:21 +0100
committerAkshay <[email protected]>2021-10-28 12:44:21 +0100
commita627799e2a0989201416a11b8d3bf1af0be86073 (patch)
tree556e08c309525fb2d89136235bb925dd5577f759 /lib
parentaa1a85527613ca8cabd5b7134ab46833564439c7 (diff)
improve json output
The `at` field now includes a `from` and `to` position with line and column information, instead of a [usize; 2].
Diffstat (limited to 'lib')
-rw-r--r--lib/src/lib.rs6
-rw-r--r--lib/src/lints/manual_inherit_from.rs1
2 files changed, 7 insertions, 0 deletions
diff --git a/lib/src/lib.rs b/lib/src/lib.rs
index 753e5c1..ec96f50 100644
--- a/lib/src/lib.rs
+++ b/lib/src/lib.rs
@@ -13,6 +13,12 @@ use serde::{
13 Serialize, 13 Serialize,
14}; 14};
15 15
16#[cfg_attr(feature = "json-out", derive(Serialize))]
17pub struct Position {
18 line: usize,
19 column: usize,
20}
21
16/// Report generated by a lint 22/// Report generated by a lint
17#[derive(Debug, Default)] 23#[derive(Debug, Default)]
18#[cfg_attr(feature = "json-out", derive(Serialize))] 24#[cfg_attr(feature = "json-out", derive(Serialize))]
diff --git a/lib/src/lints/manual_inherit_from.rs b/lib/src/lints/manual_inherit_from.rs
index 355ed8a..794aaf9 100644
--- a/lib/src/lints/manual_inherit_from.rs
+++ b/lib/src/lints/manual_inherit_from.rs
@@ -22,6 +22,7 @@ impl Rule for ManualInherit {
22 if let Some(key_value_stmt) = KeyValue::cast(node.clone()); 22 if let Some(key_value_stmt) = KeyValue::cast(node.clone());
23 if let mut key_path = key_value_stmt.key()?.path(); 23 if let mut key_path = key_value_stmt.key()?.path();
24 if let Some(key_node) = key_path.next(); 24 if let Some(key_node) = key_path.next();
25 // ensure that path has exactly one component
25 if key_path.next().is_none(); 26 if key_path.next().is_none();
26 if let Some(key) = Ident::cast(key_node); 27 if let Some(key) = Ident::cast(key_node);
27 28