From 6cd2131cafd29ae17442efbcce652bd447576f27 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 11:58:41 +0200 Subject: Rename Rename --- crates/ra_syntax/src/ast/make.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/ra_syntax/src/ast/make.rs') diff --git a/crates/ra_syntax/src/ast/make.rs b/crates/ra_syntax/src/ast/make.rs index 192c610f1..2b05ed2d4 100644 --- a/crates/ra_syntax/src/ast/make.rs +++ b/crates/ra_syntax/src/ast/make.rs @@ -37,7 +37,7 @@ fn path_from_text(text: &str) -> ast::Path { pub fn use_tree( path: ast::Path, use_tree_list: Option, - alias: Option, + alias: Option, add_star: bool, ) -> ast::UseTree { let mut buf = "use ".to_string(); -- cgit v1.2.3 From b1332670c7c471a59f3da113b366e74ac194c38b Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 14:12:04 +0200 Subject: Rename UseItem -> Use --- crates/ra_syntax/src/ast/make.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/ra_syntax/src/ast/make.rs') diff --git a/crates/ra_syntax/src/ast/make.rs b/crates/ra_syntax/src/ast/make.rs index 2b05ed2d4..0ff69bc2d 100644 --- a/crates/ra_syntax/src/ast/make.rs +++ b/crates/ra_syntax/src/ast/make.rs @@ -60,7 +60,7 @@ pub fn use_tree_list(use_trees: impl IntoIterator) -> ast:: ast_from_text(&format!("use {{{}}};", use_trees)) } -pub fn use_item(use_tree: ast::UseTree) -> ast::UseItem { +pub fn use_item(use_tree: ast::UseTree) -> ast::Use { ast_from_text(&format!("use {};", use_tree)) } -- cgit v1.2.3 From 1142112c70b705f59b7d559d9d72cdc831865158 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 14:51:08 +0200 Subject: Rename FnDef -> Fn --- crates/ra_syntax/src/ast/make.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/ra_syntax/src/ast/make.rs') diff --git a/crates/ra_syntax/src/ast/make.rs b/crates/ra_syntax/src/ast/make.rs index 0ff69bc2d..ef235680f 100644 --- a/crates/ra_syntax/src/ast/make.rs +++ b/crates/ra_syntax/src/ast/make.rs @@ -294,7 +294,7 @@ pub fn fn_def( type_params: Option, params: ast::ParamList, body: ast::BlockExpr, -) -> ast::FnDef { +) -> ast::Fn { let type_params = if let Some(type_params) = type_params { format!("<{}>", type_params) } else { "".into() }; let visibility = match visibility { -- cgit v1.2.3 From 28ef4c375a9f56d69daf885504aea3df7012bb81 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 15:36:21 +0200 Subject: Rename TypeParamList -> GenericParamList --- crates/ra_syntax/src/ast/make.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/ra_syntax/src/ast/make.rs') diff --git a/crates/ra_syntax/src/ast/make.rs b/crates/ra_syntax/src/ast/make.rs index ef235680f..4759f23a5 100644 --- a/crates/ra_syntax/src/ast/make.rs +++ b/crates/ra_syntax/src/ast/make.rs @@ -291,7 +291,7 @@ pub fn visibility_pub_crate() -> ast::Visibility { pub fn fn_def( visibility: Option, fn_name: ast::Name, - type_params: Option, + type_params: Option, params: ast::ParamList, body: ast::BlockExpr, ) -> ast::Fn { -- cgit v1.2.3 From 6f8aa75329d0a4e588e58b8f22f7932bf3d3a706 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 16:21:30 +0200 Subject: Rename RecordLit -> RecordExpr --- crates/ra_syntax/src/ast/make.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/ra_syntax/src/ast/make.rs') diff --git a/crates/ra_syntax/src/ast/make.rs b/crates/ra_syntax/src/ast/make.rs index 4759f23a5..183ec4481 100644 --- a/crates/ra_syntax/src/ast/make.rs +++ b/crates/ra_syntax/src/ast/make.rs @@ -64,13 +64,13 @@ pub fn use_item(use_tree: ast::UseTree) -> ast::Use { ast_from_text(&format!("use {};", use_tree)) } -pub fn record_field(name: ast::NameRef, expr: Option) -> ast::RecordField { +pub fn record_field(name: ast::NameRef, expr: Option) -> ast::RecordExprField { return match expr { Some(expr) => from_text(&format!("{}: {}", name, expr)), None => from_text(&name.to_string()), }; - fn from_text(text: &str) -> ast::RecordField { + fn from_text(text: &str) -> ast::RecordExprField { ast_from_text(&format!("fn f() {{ S {{ {}, }} }}", text)) } } -- cgit v1.2.3 From 0a9e3ccc262fbcbd4cdaab30384f8cb71584544b Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 16:49:13 +0200 Subject: Rename FieldDef -> Field --- crates/ra_syntax/src/ast/make.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/ra_syntax/src/ast/make.rs') diff --git a/crates/ra_syntax/src/ast/make.rs b/crates/ra_syntax/src/ast/make.rs index 183ec4481..509e8ae7a 100644 --- a/crates/ra_syntax/src/ast/make.rs +++ b/crates/ra_syntax/src/ast/make.rs @@ -75,7 +75,7 @@ pub fn record_field(name: ast::NameRef, expr: Option) -> ast::RecordE } } -pub fn record_field_def(name: ast::NameRef, ty: ast::TypeRef) -> ast::RecordFieldDef { +pub fn record_field_def(name: ast::NameRef, ty: ast::TypeRef) -> ast::RecordField { ast_from_text(&format!("struct S {{ {}: {}, }}", name, ty)) } -- cgit v1.2.3 From 08ea2271e8050165d0aaf4c994ed3dd746aff3ba Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 31 Jul 2020 12:06:38 +0200 Subject: Rename TypeRef -> Type The TypeRef name comes from IntelliJ days, where you often have both type *syntax* as well as *semantical* representation of types in scope. And naming both Type is confusing. In rust-analyzer however, we use ast types as `ast::Type`, and have many more semantic counterparts to ast types, so avoiding name clash here is just confusing. --- crates/ra_syntax/src/ast/make.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/ra_syntax/src/ast/make.rs') diff --git a/crates/ra_syntax/src/ast/make.rs b/crates/ra_syntax/src/ast/make.rs index 509e8ae7a..3d4fed64c 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 { ast_from_text(&format!("fn f() {{ {}; }}", text)) } -pub fn type_ref(text: &str) -> ast::TypeRef { +pub fn type_ref(text: &str) -> ast::Type { ast_from_text(&format!("impl {} for D {{}};", text)) } @@ -75,7 +75,7 @@ pub fn record_field(name: ast::NameRef, expr: Option) -> ast::RecordE } } -pub fn record_field_def(name: ast::NameRef, ty: ast::TypeRef) -> ast::RecordField { +pub fn record_field_def(name: ast::NameRef, ty: ast::Type) -> ast::RecordField { ast_from_text(&format!("struct S {{ {}: {}, }}", name, ty)) } -- cgit v1.2.3 From 6791eb9685375da94556bb910ea71f78b08be5ec Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 31 Jul 2020 20:07:21 +0200 Subject: Rename PalceholderPat -> WildcardPat --- crates/ra_syntax/src/ast/make.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/ra_syntax/src/ast/make.rs') diff --git a/crates/ra_syntax/src/ast/make.rs b/crates/ra_syntax/src/ast/make.rs index 3d4fed64c..efb2cb4a3 100644 --- a/crates/ra_syntax/src/ast/make.rs +++ b/crates/ra_syntax/src/ast/make.rs @@ -156,10 +156,10 @@ pub fn bind_pat(name: ast::Name) -> ast::BindPat { } } -pub fn placeholder_pat() -> ast::PlaceholderPat { +pub fn placeholder_pat() -> ast::WildcardPat { return from_text("_"); - fn from_text(text: &str) -> ast::PlaceholderPat { + fn from_text(text: &str) -> ast::WildcardPat { ast_from_text(&format!("fn f({}: ())", text)) } } -- cgit v1.2.3 From 98181087984157e27faba0b969e384f3c62c39d5 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 31 Jul 2020 20:09:09 +0200 Subject: Rename BindPat -> IdentPat --- crates/ra_syntax/src/ast/make.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/ra_syntax/src/ast/make.rs') diff --git a/crates/ra_syntax/src/ast/make.rs b/crates/ra_syntax/src/ast/make.rs index efb2cb4a3..673777015 100644 --- a/crates/ra_syntax/src/ast/make.rs +++ b/crates/ra_syntax/src/ast/make.rs @@ -148,10 +148,10 @@ pub fn condition(expr: ast::Expr, pattern: Option) -> ast::Condition { } } -pub fn bind_pat(name: ast::Name) -> ast::BindPat { +pub fn bind_pat(name: ast::Name) -> ast::IdentPat { return from_text(name.text()); - fn from_text(text: &str) -> ast::BindPat { + fn from_text(text: &str) -> ast::IdentPat { ast_from_text(&format!("fn f({}: ())", text)) } } -- cgit v1.2.3 From edd79a6b1c6e019d69d8d1304686391ea9cb4209 Mon Sep 17 00:00:00 2001 From: unexge Date: Sun, 2 Aug 2020 22:56:54 +0300 Subject: Add expand glob import assist --- crates/ra_syntax/src/ast/make.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/ra_syntax/src/ast/make.rs') diff --git a/crates/ra_syntax/src/ast/make.rs b/crates/ra_syntax/src/ast/make.rs index 673777015..3cb1d35ee 100644 --- a/crates/ra_syntax/src/ast/make.rs +++ b/crates/ra_syntax/src/ast/make.rs @@ -30,7 +30,7 @@ pub fn path_unqualified(segment: ast::PathSegment) -> ast::Path { pub fn path_qualified(qual: ast::Path, segment: ast::PathSegment) -> ast::Path { path_from_text(&format!("{}::{}", qual, segment)) } -fn path_from_text(text: &str) -> ast::Path { +pub fn path_from_text(text: &str) -> ast::Path { ast_from_text(text) } -- cgit v1.2.3 From 09d3b7d7a2ae23a0463fadee9ae8cb6a0fa2c4bf Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 5 Aug 2020 19:29:24 +0200 Subject: align names in make --- crates/ra_syntax/src/ast/make.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'crates/ra_syntax/src/ast/make.rs') diff --git a/crates/ra_syntax/src/ast/make.rs b/crates/ra_syntax/src/ast/make.rs index 3cb1d35ee..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 { ast_from_text(&format!("fn f() {{ {}; }}", text)) } -pub fn type_ref(text: &str) -> ast::Type { +pub fn ty(text: &str) -> ast::Type { ast_from_text(&format!("impl {} for D {{}};", text)) } @@ -60,11 +60,11 @@ pub fn use_tree_list(use_trees: impl IntoIterator) -> ast:: ast_from_text(&format!("use {{{}}};", use_trees)) } -pub fn use_item(use_tree: ast::UseTree) -> ast::Use { +pub fn use_(use_tree: ast::UseTree) -> ast::Use { ast_from_text(&format!("use {};", use_tree)) } -pub fn record_field(name: ast::NameRef, expr: Option) -> ast::RecordExprField { +pub fn record_expr_field(name: ast::NameRef, expr: Option) -> ast::RecordExprField { return match expr { Some(expr) => from_text(&format!("{}: {}", name, expr)), None => from_text(&name.to_string()), @@ -75,7 +75,7 @@ pub fn record_field(name: ast::NameRef, expr: Option) -> ast::RecordE } } -pub fn record_field_def(name: ast::NameRef, ty: ast::Type) -> ast::RecordField { +pub fn record_field(name: ast::NameRef, ty: ast::Type) -> ast::RecordField { ast_from_text(&format!("struct S {{ {}: {}, }}", name, ty)) } @@ -148,7 +148,7 @@ pub fn condition(expr: ast::Expr, pattern: Option) -> ast::Condition { } } -pub fn bind_pat(name: ast::Name) -> ast::IdentPat { +pub fn ident_pat(name: ast::Name) -> ast::IdentPat { return from_text(name.text()); fn from_text(text: &str) -> ast::IdentPat { @@ -156,7 +156,7 @@ pub fn bind_pat(name: ast::Name) -> ast::IdentPat { } } -pub fn placeholder_pat() -> ast::WildcardPat { +pub fn wildcard_pat() -> ast::WildcardPat { return from_text("_"); fn from_text(text: &str) -> ast::WildcardPat { @@ -288,7 +288,7 @@ pub fn visibility_pub_crate() -> ast::Visibility { ast_from_text("pub(crate) struct S") } -pub fn fn_def( +pub fn fn_( visibility: Option, fn_name: ast::Name, type_params: Option, -- cgit v1.2.3