diff options
Diffstat (limited to 'crates/ra_syntax/src/ast.rs')
-rw-r--r-- | crates/ra_syntax/src/ast.rs | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/crates/ra_syntax/src/ast.rs b/crates/ra_syntax/src/ast.rs index 1ee60e74c..99c6b7219 100644 --- a/crates/ra_syntax/src/ast.rs +++ b/crates/ra_syntax/src/ast.rs | |||
@@ -80,7 +80,7 @@ impl<N: AstNode> Iterator for AstChildren<N> { | |||
80 | } | 80 | } |
81 | 81 | ||
82 | mod support { | 82 | mod support { |
83 | use super::{AstChildren, AstNode, AstToken, SyntaxKind, SyntaxNode, SyntaxToken}; | 83 | use super::{AstChildren, AstNode, SyntaxKind, SyntaxNode, SyntaxToken}; |
84 | 84 | ||
85 | pub(super) fn child<N: AstNode>(parent: &SyntaxNode) -> Option<N> { | 85 | pub(super) fn child<N: AstNode>(parent: &SyntaxNode) -> Option<N> { |
86 | parent.children().find_map(N::cast) | 86 | parent.children().find_map(N::cast) |
@@ -90,11 +90,7 @@ mod support { | |||
90 | AstChildren::new(parent) | 90 | AstChildren::new(parent) |
91 | } | 91 | } |
92 | 92 | ||
93 | pub(super) fn token<T: AstToken>(parent: &SyntaxNode) -> Option<T> { | 93 | pub(super) fn token(parent: &SyntaxNode, kind: SyntaxKind) -> Option<SyntaxToken> { |
94 | parent.children_with_tokens().filter_map(|it| it.into_token()).find_map(T::cast) | ||
95 | } | ||
96 | |||
97 | pub(super) fn token2(parent: &SyntaxNode, kind: SyntaxKind) -> Option<SyntaxToken> { | ||
98 | parent.children_with_tokens().filter_map(|it| it.into_token()).find(|it| it.kind() == kind) | 94 | parent.children_with_tokens().filter_map(|it| it.into_token()).find(|it| it.kind() == kind) |
99 | } | 95 | } |
100 | } | 96 | } |