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_ide/src/display/short_label.rs | 2 +- crates/ra_ide/src/file_structure.rs | 2 +- crates/ra_ide/src/references/rename.rs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'crates/ra_ide') diff --git a/crates/ra_ide/src/display/short_label.rs b/crates/ra_ide/src/display/short_label.rs index bddf1bd47..0fdf8e9a5 100644 --- a/crates/ra_ide/src/display/short_label.rs +++ b/crates/ra_ide/src/display/short_label.rs @@ -77,7 +77,7 @@ impl ShortLabel for ast::Variant { } } -fn short_label_from_ty(node: &T, ty: Option, prefix: &str) -> Option +fn short_label_from_ty(node: &T, ty: Option, prefix: &str) -> Option where T: NameOwner + VisibilityOwner, { diff --git a/crates/ra_ide/src/file_structure.rs b/crates/ra_ide/src/file_structure.rs index 91765140a..ef368651a 100644 --- a/crates/ra_ide/src/file_structure.rs +++ b/crates/ra_ide/src/file_structure.rs @@ -57,7 +57,7 @@ fn structure_node(node: &SyntaxNode) -> Option { fn decl_with_type_ref( node: &N, - type_ref: Option, + type_ref: Option, ) -> Option { let detail = type_ref.map(|type_ref| { let mut detail = String::new(); diff --git a/crates/ra_ide/src/references/rename.rs b/crates/ra_ide/src/references/rename.rs index 31654bf79..96aed7cc7 100644 --- a/crates/ra_ide/src/references/rename.rs +++ b/crates/ra_ide/src/references/rename.rs @@ -157,7 +157,7 @@ fn rename_to_self( } let first_param = params.params().next()?; let mutable = match first_param.ty() { - Some(ast::TypeRef::ReferenceType(rt)) => rt.mut_token().is_some(), + Some(ast::Type::ReferenceType(rt)) => rt.mut_token().is_some(), _ => return None, // not renaming other types }; @@ -194,7 +194,7 @@ fn text_edit_from_self_param( new_name: &str, ) -> Option { fn target_type_name(impl_def: &ast::Impl) -> Option { - if let Some(ast::TypeRef::PathType(p)) = impl_def.target_type() { + if let Some(ast::Type::PathType(p)) = impl_def.target_type() { return Some(p.path()?.segment()?.name_ref()?.text().to_string()); } None -- cgit v1.2.3