diff options
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r-- | crates/ra_syntax/src/reparsing.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/crates/ra_syntax/src/reparsing.rs b/crates/ra_syntax/src/reparsing.rs index a0014e016..377152de4 100644 --- a/crates/ra_syntax/src/reparsing.rs +++ b/crates/ra_syntax/src/reparsing.rs | |||
@@ -98,17 +98,18 @@ fn is_contextual_kw(text: &str) -> bool { | |||
98 | } | 98 | } |
99 | } | 99 | } |
100 | 100 | ||
101 | fn find_reparsable_node<'node>( | 101 | type ParseFn = fn(&mut Parser); |
102 | node: SyntaxNodeRef<'node>, | 102 | fn find_reparsable_node( |
103 | node: SyntaxNodeRef<'_>, | ||
103 | range: TextRange, | 104 | range: TextRange, |
104 | ) -> Option<(SyntaxNodeRef<'node>, fn(&mut Parser))> { | 105 | ) -> Option<(SyntaxNodeRef<'_>, ParseFn)> { |
105 | let node = algo::find_covering_node(node, range); | 106 | let node = algo::find_covering_node(node, range); |
106 | return node | 107 | return node |
107 | .ancestors() | 108 | .ancestors() |
108 | .filter_map(|node| reparser(node).map(|r| (node, r))) | 109 | .filter_map(|node| reparser(node).map(|r| (node, r))) |
109 | .next(); | 110 | .next(); |
110 | 111 | ||
111 | fn reparser(node: SyntaxNodeRef) -> Option<fn(&mut Parser)> { | 112 | fn reparser(node: SyntaxNodeRef) -> Option<ParseFn> { |
112 | let res = match node.kind() { | 113 | let res = match node.kind() { |
113 | BLOCK => grammar::block, | 114 | BLOCK => grammar::block, |
114 | NAMED_FIELD_DEF_LIST => grammar::named_field_def_list, | 115 | NAMED_FIELD_DEF_LIST => grammar::named_field_def_list, |