diff options
Diffstat (limited to 'crates/syntax/src')
-rw-r--r-- | crates/syntax/src/ast/edit.rs | 4 | ||||
-rw-r--r-- | crates/syntax/src/ast/node_ext.rs | 8 |
2 files changed, 10 insertions, 2 deletions
diff --git a/crates/syntax/src/ast/edit.rs b/crates/syntax/src/ast/edit.rs index 77233ab31..824ebf41c 100644 --- a/crates/syntax/src/ast/edit.rs +++ b/crates/syntax/src/ast/edit.rs | |||
@@ -220,7 +220,7 @@ impl ast::RecordExprFieldList { | |||
220 | InsertPosition::After($anchor.syntax().clone().into()) | 220 | InsertPosition::After($anchor.syntax().clone().into()) |
221 | } | 221 | } |
222 | }; | 222 | }; |
223 | }; | 223 | } |
224 | 224 | ||
225 | let position = match position { | 225 | let position = match position { |
226 | InsertPosition::First => after_l_curly!(), | 226 | InsertPosition::First => after_l_curly!(), |
@@ -533,7 +533,7 @@ impl ast::GenericParamList { | |||
533 | InsertPosition::After($anchor.syntax().clone().into()) | 533 | InsertPosition::After($anchor.syntax().clone().into()) |
534 | } | 534 | } |
535 | }; | 535 | }; |
536 | }; | 536 | } |
537 | 537 | ||
538 | let position = match self.generic_params().last() { | 538 | let position = match self.generic_params().last() { |
539 | Some(it) => after_field!(it), | 539 | Some(it) => after_field!(it), |
diff --git a/crates/syntax/src/ast/node_ext.rs b/crates/syntax/src/ast/node_ext.rs index c45cb514a..2aa472fb4 100644 --- a/crates/syntax/src/ast/node_ext.rs +++ b/crates/syntax/src/ast/node_ext.rs | |||
@@ -193,6 +193,14 @@ impl ast::UseTreeList { | |||
193 | .and_then(ast::UseTree::cast) | 193 | .and_then(ast::UseTree::cast) |
194 | .expect("UseTreeLists are always nested in UseTrees") | 194 | .expect("UseTreeLists are always nested in UseTrees") |
195 | } | 195 | } |
196 | |||
197 | pub fn has_inner_comment(&self) -> bool { | ||
198 | self.syntax() | ||
199 | .children_with_tokens() | ||
200 | .filter_map(|it| it.into_token()) | ||
201 | .find_map(ast::Comment::cast) | ||
202 | .is_some() | ||
203 | } | ||
196 | } | 204 | } |
197 | 205 | ||
198 | impl ast::Impl { | 206 | impl ast::Impl { |