aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-11-07 18:38:41 +0000
committerAleksey Kladov <[email protected]>2018-11-07 18:38:41 +0000
commit6d253b58da955cee73b0715b91d728df5009937d (patch)
tree8951f181a563fbb08199ab99f383f2d01a756f05 /crates/ra_syntax
parent06fbc6e3edca1e53f1034bf779f2677d87076c1c (diff)
Complete paths in use trees
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r--crates/ra_syntax/src/ast/mod.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/ast/mod.rs b/crates/ra_syntax/src/ast/mod.rs
index d93f92672..6b0d62610 100644
--- a/crates/ra_syntax/src/ast/mod.rs
+++ b/crates/ra_syntax/src/ast/mod.rs
@@ -296,6 +296,15 @@ impl<'a> PathSegment<'a> {
296 } 296 }
297} 297}
298 298
299impl<'a> UseTreeList<'a> {
300 pub fn parent_use_tree(self) -> UseTree<'a> {
301 self.syntax()
302 .parent()
303 .and_then(UseTree::cast)
304 .expect("UseTreeLists are always nested in UseTrees")
305 }
306}
307
299fn child_opt<'a, P: AstNode<'a>, C: AstNode<'a>>(parent: P) -> Option<C> { 308fn child_opt<'a, P: AstNode<'a>, C: AstNode<'a>>(parent: P) -> Option<C> {
300 children(parent).next() 309 children(parent).next()
301} 310}