mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 22:54:58 +00:00
Complete paths in use trees
This commit is contained in:
parent
06fbc6e3ed
commit
6d253b58da
3 changed files with 66 additions and 5 deletions
|
@ -296,6 +296,15 @@ impl<'a> PathSegment<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> UseTreeList<'a> {
|
||||
pub fn parent_use_tree(self) -> UseTree<'a> {
|
||||
self.syntax()
|
||||
.parent()
|
||||
.and_then(UseTree::cast)
|
||||
.expect("UseTreeLists are always nested in UseTrees")
|
||||
}
|
||||
}
|
||||
|
||||
fn child_opt<'a, P: AstNode<'a>, C: AstNode<'a>>(parent: P) -> Option<C> {
|
||||
children(parent).next()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue