File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ impl Rule for ManualInherit {
48
48
if let key_path = key_value_stmt. attrpath( ) ?;
49
49
if let Some ( key_node) = key_path. attrs( ) . next( ) ;
50
50
// ensure that path has exactly one component
51
- if key_path. attrs( ) . next ( ) . is_none ( ) ;
51
+ if key_path. attrs( ) . count ( ) == 1 ;
52
52
if let Some ( key) = Ident :: cast( key_node. syntax( ) . clone( ) ) ;
53
53
54
54
if let Some ( value_node) = key_value_stmt. value( ) ;
Original file line number Diff line number Diff line change @@ -42,18 +42,19 @@ struct ManualInheritFrom;
42
42
43
43
impl Rule for ManualInheritFrom {
44
44
fn validate ( & self , node : & SyntaxElement , _sess : & SessionInfo ) -> Option < Report > {
45
+ println ! ( "===" ) ;
45
46
if_chain ! {
46
47
if let NodeOrToken :: Node ( node) = node;
47
48
if let Some ( key_value_stmt) = AttrpathValue :: cast( node. clone( ) ) ;
48
- if let mut key_path = key_value_stmt. attrpath( ) ?. attrs ( ) ;
49
- if let Some ( key_node) = key_path. next( ) ;
49
+ if let key_path = key_value_stmt. attrpath( ) ?;
50
+ if let Some ( key_node) = key_path. attrs ( ) . next( ) ;
50
51
// ensure that path has exactly one component
51
- if key_path. next ( ) . is_none ( ) ;
52
+ if key_path. attrs ( ) . count ( ) == 1 ;
52
53
if let Some ( key) = Ident :: cast( key_node. syntax( ) . clone( ) ) ;
53
54
54
55
if let Some ( value_node) = key_value_stmt. value( ) ;
55
56
if let Some ( value) = Select :: cast( value_node. syntax( ) . clone( ) ) ;
56
- if let Some ( index_node) = value. expr ( ) ;
57
+ if let Some ( index_node) = value. attrpath ( ) . and_then ( |attrs| attrs . attrs ( ) . next ( ) ) ;
57
58
if let Some ( index) = Ident :: cast( index_node. syntax( ) . clone( ) ) ;
58
59
59
60
if key. to_string( ) == index. to_string( ) ;
You can’t perform that action at this time.
0 commit comments