aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_expand/src
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2020-01-05 20:32:18 +0000
committerFlorian Diebold <[email protected]>2020-01-11 22:33:04 +0000
commit12905e5b58f22df026ef30afa6f0bdf7319cbddd (patch)
tree2efbeb8360a59f146219ca22dad7813f24237c12 /crates/ra_hir_expand/src
parentdef124e932f02f5961d26af6cc03f696f389205f (diff)
Some more refactoring
Diffstat (limited to 'crates/ra_hir_expand/src')
-rw-r--r--crates/ra_hir_expand/src/lib.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/crates/ra_hir_expand/src/lib.rs b/crates/ra_hir_expand/src/lib.rs
index 2fa5d5140..51c5f9623 100644
--- a/crates/ra_hir_expand/src/lib.rs
+++ b/crates/ra_hir_expand/src/lib.rs
@@ -322,3 +322,13 @@ impl InFile<SyntaxNode> {
322 }) 322 })
323 } 323 }
324} 324}
325
326impl<N: AstNode> InFile<N> {
327 pub fn descendants<T: AstNode>(self) -> impl Iterator<Item = InFile<T>> {
328 self.value.syntax().descendants().filter_map(T::cast).map(move |n| self.with_value(n))
329 }
330
331 pub fn syntax(&self) -> InFile<&SyntaxNode> {
332 self.with_value(self.value.syntax())
333 }
334}