diff options
Diffstat (limited to 'lib/src/lints/manual_inherit.rs')
-rw-r--r-- | lib/src/lints/manual_inherit.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/src/lints/manual_inherit.rs b/lib/src/lints/manual_inherit.rs index 69f032b..0a6933c 100644 --- a/lib/src/lints/manual_inherit.rs +++ b/lib/src/lints/manual_inherit.rs | |||
@@ -3,7 +3,7 @@ use crate::{make, Lint, Metadata, Report, Rule, Suggestion}; | |||
3 | use if_chain::if_chain; | 3 | use if_chain::if_chain; |
4 | use macros::lint; | 4 | use macros::lint; |
5 | use rnix::{ | 5 | use rnix::{ |
6 | types::{KeyValue, Ident, TypedNode, TokenWrapper}, | 6 | types::{Ident, KeyValue, TokenWrapper, TypedNode}, |
7 | NodeOrToken, SyntaxElement, SyntaxKind, | 7 | NodeOrToken, SyntaxElement, SyntaxKind, |
8 | }; | 8 | }; |
9 | 9 | ||
@@ -20,8 +20,10 @@ impl Rule for ManualInherit { | |||
20 | if_chain! { | 20 | if_chain! { |
21 | if let NodeOrToken::Node(node) = node; | 21 | if let NodeOrToken::Node(node) = node; |
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 Some(key_path) = key_value_stmt.key(); | 23 | if let mut key_path = key_value_stmt.key()?.path(); |
24 | if let Some(key_node) = key_path.path().next(); | 24 | if let Some(key_node) = key_path.next(); |
25 | // ensure that path has exactly one component | ||
26 | if key_path.next().is_none(); | ||
25 | if let Some(key) = Ident::cast(key_node); | 27 | if let Some(key) = Ident::cast(key_node); |
26 | 28 | ||
27 | if let Some(value_node) = key_value_stmt.value(); | 29 | if let Some(value_node) = key_value_stmt.value(); |
@@ -40,4 +42,3 @@ impl Rule for ManualInherit { | |||
40 | } | 42 | } |
41 | } | 43 | } |
42 | } | 44 | } |
43 | |||