aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax
diff options
context:
space:
mode:
authorJonas Schievink <[email protected]>2020-07-14 12:12:16 +0100
committerJonas Schievink <[email protected]>2020-07-14 12:12:16 +0100
commit0f654b06ab093e7bb057cfd68b27925803b003d8 (patch)
treec3fe1dd48945a139ba59c2e48453d8037efc5fe6 /crates/ra_syntax
parent510866b4a1a812414568bd96f1d197587ead78c0 (diff)
missing impl members: remove assoc. type bounds
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r--crates/ra_syntax/src/ast/make.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/ast/make.rs b/crates/ra_syntax/src/ast/make.rs
index 192c610f1..42116afbb 100644
--- a/crates/ra_syntax/src/ast/make.rs
+++ b/crates/ra_syntax/src/ast/make.rs
@@ -64,6 +64,19 @@ pub fn use_item(use_tree: ast::UseTree) -> ast::UseItem {
64 ast_from_text(&format!("use {};", use_tree)) 64 ast_from_text(&format!("use {};", use_tree))
65} 65}
66 66
67pub fn type_alias_def(
68 name: ast::Name,
69 bounds: Option<ast::TypeBoundList>,
70 ty: Option<ast::TypeRef>,
71) -> ast::TypeAliasDef {
72 match (bounds, ty) {
73 (None, None) => ast_from_text(&format!("type {};", name)),
74 (None, Some(ty)) => ast_from_text(&format!("type {} = {};", name, ty)),
75 (Some(bounds), None) => ast_from_text(&format!("type {}: {};", name, bounds)),
76 (Some(bounds), Some(ty)) => ast_from_text(&format!("type {}: {} = {};", name, bounds, ty)),
77 }
78}
79
67pub fn record_field(name: ast::NameRef, expr: Option<ast::Expr>) -> ast::RecordField { 80pub fn record_field(name: ast::NameRef, expr: Option<ast::Expr>) -> ast::RecordField {
68 return match expr { 81 return match expr {
69 Some(expr) => from_text(&format!("{}: {}", name, expr)), 82 Some(expr) => from_text(&format!("{}: {}", name, expr)),