diff options
Diffstat (limited to 'crates/ra_syntax/src/ast/make.rs')
-rw-r--r-- | crates/ra_syntax/src/ast/make.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/crates/ra_syntax/src/ast/make.rs b/crates/ra_syntax/src/ast/make.rs index 673777015..254a37fe3 100644 --- a/crates/ra_syntax/src/ast/make.rs +++ b/crates/ra_syntax/src/ast/make.rs | |||
@@ -17,7 +17,7 @@ pub fn name_ref(text: &str) -> ast::NameRef { | |||
17 | ast_from_text(&format!("fn f() {{ {}; }}", text)) | 17 | ast_from_text(&format!("fn f() {{ {}; }}", text)) |
18 | } | 18 | } |
19 | 19 | ||
20 | pub fn type_ref(text: &str) -> ast::Type { | 20 | pub fn ty(text: &str) -> ast::Type { |
21 | ast_from_text(&format!("impl {} for D {{}};", text)) | 21 | ast_from_text(&format!("impl {} for D {{}};", text)) |
22 | } | 22 | } |
23 | 23 | ||
@@ -30,7 +30,7 @@ pub fn path_unqualified(segment: ast::PathSegment) -> ast::Path { | |||
30 | pub fn path_qualified(qual: ast::Path, segment: ast::PathSegment) -> ast::Path { | 30 | pub fn path_qualified(qual: ast::Path, segment: ast::PathSegment) -> ast::Path { |
31 | path_from_text(&format!("{}::{}", qual, segment)) | 31 | path_from_text(&format!("{}::{}", qual, segment)) |
32 | } | 32 | } |
33 | fn path_from_text(text: &str) -> ast::Path { | 33 | pub fn path_from_text(text: &str) -> ast::Path { |
34 | ast_from_text(text) | 34 | ast_from_text(text) |
35 | } | 35 | } |
36 | 36 | ||
@@ -60,11 +60,11 @@ pub fn use_tree_list(use_trees: impl IntoIterator<Item = ast::UseTree>) -> ast:: | |||
60 | ast_from_text(&format!("use {{{}}};", use_trees)) | 60 | ast_from_text(&format!("use {{{}}};", use_trees)) |
61 | } | 61 | } |
62 | 62 | ||
63 | pub fn use_item(use_tree: ast::UseTree) -> ast::Use { | 63 | pub fn use_(use_tree: ast::UseTree) -> ast::Use { |
64 | ast_from_text(&format!("use {};", use_tree)) | 64 | ast_from_text(&format!("use {};", use_tree)) |
65 | } | 65 | } |
66 | 66 | ||
67 | pub fn record_field(name: ast::NameRef, expr: Option<ast::Expr>) -> ast::RecordExprField { | 67 | pub fn record_expr_field(name: ast::NameRef, expr: Option<ast::Expr>) -> ast::RecordExprField { |
68 | return match expr { | 68 | return match expr { |
69 | Some(expr) => from_text(&format!("{}: {}", name, expr)), | 69 | Some(expr) => from_text(&format!("{}: {}", name, expr)), |
70 | None => from_text(&name.to_string()), | 70 | None => from_text(&name.to_string()), |
@@ -75,7 +75,7 @@ pub fn record_field(name: ast::NameRef, expr: Option<ast::Expr>) -> ast::RecordE | |||
75 | } | 75 | } |
76 | } | 76 | } |
77 | 77 | ||
78 | pub fn record_field_def(name: ast::NameRef, ty: ast::Type) -> ast::RecordField { | 78 | pub fn record_field(name: ast::NameRef, ty: ast::Type) -> ast::RecordField { |
79 | ast_from_text(&format!("struct S {{ {}: {}, }}", name, ty)) | 79 | ast_from_text(&format!("struct S {{ {}: {}, }}", name, ty)) |
80 | } | 80 | } |
81 | 81 | ||
@@ -148,7 +148,7 @@ pub fn condition(expr: ast::Expr, pattern: Option<ast::Pat>) -> ast::Condition { | |||
148 | } | 148 | } |
149 | } | 149 | } |
150 | 150 | ||
151 | pub fn bind_pat(name: ast::Name) -> ast::IdentPat { | 151 | pub fn ident_pat(name: ast::Name) -> ast::IdentPat { |
152 | return from_text(name.text()); | 152 | return from_text(name.text()); |
153 | 153 | ||
154 | fn from_text(text: &str) -> ast::IdentPat { | 154 | fn from_text(text: &str) -> ast::IdentPat { |
@@ -156,7 +156,7 @@ pub fn bind_pat(name: ast::Name) -> ast::IdentPat { | |||
156 | } | 156 | } |
157 | } | 157 | } |
158 | 158 | ||
159 | pub fn placeholder_pat() -> ast::WildcardPat { | 159 | pub fn wildcard_pat() -> ast::WildcardPat { |
160 | return from_text("_"); | 160 | return from_text("_"); |
161 | 161 | ||
162 | fn from_text(text: &str) -> ast::WildcardPat { | 162 | fn from_text(text: &str) -> ast::WildcardPat { |
@@ -288,7 +288,7 @@ pub fn visibility_pub_crate() -> ast::Visibility { | |||
288 | ast_from_text("pub(crate) struct S") | 288 | ast_from_text("pub(crate) struct S") |
289 | } | 289 | } |
290 | 290 | ||
291 | pub fn fn_def( | 291 | pub fn fn_( |
292 | visibility: Option<ast::Visibility>, | 292 | visibility: Option<ast::Visibility>, |
293 | fn_name: ast::Name, | 293 | fn_name: ast::Name, |
294 | type_params: Option<ast::GenericParamList>, | 294 | type_params: Option<ast::GenericParamList>, |