aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r--crates/ra_syntax/src/ast/make.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/crates/ra_syntax/src/ast/make.rs b/crates/ra_syntax/src/ast/make.rs
index 7c20fcc10..60cd9d260 100644
--- a/crates/ra_syntax/src/ast/make.rs
+++ b/crates/ra_syntax/src/ast/make.rs
@@ -12,11 +12,14 @@ pub fn name_ref(text: &str) -> ast::NameRef {
12 ast_from_text(&format!("fn f() {{ {}; }}", text)) 12 ast_from_text(&format!("fn f() {{ {}; }}", text))
13} 13}
14 14
15pub fn path_from_name_ref(name_ref: ast::NameRef) -> ast::Path { 15pub fn path_segment(name_ref: ast::NameRef) -> ast::PathSegment {
16 path_from_text(&name_ref.syntax().to_string()) 16 ast_from_text(&format!("use {};", name_ref.syntax()))
17} 17}
18pub fn path_qualified(qual: ast::Path, name_ref: ast::NameRef) -> ast::Path { 18pub fn path_unqalified(segment: ast::PathSegment) -> ast::Path {
19 path_from_text(&format!("{}::{}", qual.syntax(), name_ref.syntax())) 19 path_from_text(&format!("use {}", segment.syntax()))
20}
21pub fn path_qualified(qual: ast::Path, segment: ast::PathSegment) -> ast::Path {
22 path_from_text(&format!("{}::{}", qual.syntax(), segment.syntax()))
20} 23}
21fn path_from_text(text: &str) -> ast::Path { 24fn path_from_text(text: &str) -> ast::Path {
22 ast_from_text(text) 25 ast_from_text(text)