diff options
Diffstat (limited to 'crates/ra_syntax/src/ast')
-rw-r--r-- | crates/ra_syntax/src/ast/make.rs | 11 |
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 | ||
15 | pub fn path_from_name_ref(name_ref: ast::NameRef) -> ast::Path { | 15 | pub 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 | } |
18 | pub fn path_qualified(qual: ast::Path, name_ref: ast::NameRef) -> ast::Path { | 18 | pub 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 | } | ||
21 | pub fn path_qualified(qual: ast::Path, segment: ast::PathSegment) -> ast::Path { | ||
22 | path_from_text(&format!("{}::{}", qual.syntax(), segment.syntax())) | ||
20 | } | 23 | } |
21 | fn path_from_text(text: &str) -> ast::Path { | 24 | fn path_from_text(text: &str) -> ast::Path { |
22 | ast_from_text(text) | 25 | ast_from_text(text) |