From f95f425ae4199e814e6956be1d9bb59a14758c07 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 21:02:55 +0200 Subject: Use ty to access most TypeRefs --- crates/ra_assists/src/handlers/change_return_type_to_result.rs | 2 +- crates/ra_assists/src/handlers/generate_from_impl_for_enum.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/ra_assists') diff --git a/crates/ra_assists/src/handlers/change_return_type_to_result.rs b/crates/ra_assists/src/handlers/change_return_type_to_result.rs index 12018fc6a..167e162d8 100644 --- a/crates/ra_assists/src/handlers/change_return_type_to_result.rs +++ b/crates/ra_assists/src/handlers/change_return_type_to_result.rs @@ -22,7 +22,7 @@ pub(crate) fn change_return_type_to_result(acc: &mut Assists, ctx: &AssistContex // FIXME: extend to lambdas as well let fn_def = ret_type.syntax().parent().and_then(ast::Fn::cast)?; - let type_ref = &ret_type.type_ref()?; + let type_ref = &ret_type.ty()?; let ret_type_str = type_ref.syntax().text().to_string(); let first_part_ret_type = ret_type_str.splitn(2, '<').next(); if let Some(ret_type_first_part) = first_part_ret_type { diff --git a/crates/ra_assists/src/handlers/generate_from_impl_for_enum.rs b/crates/ra_assists/src/handlers/generate_from_impl_for_enum.rs index 5b282a30a..9da23640a 100644 --- a/crates/ra_assists/src/handlers/generate_from_impl_for_enum.rs +++ b/crates/ra_assists/src/handlers/generate_from_impl_for_enum.rs @@ -32,7 +32,7 @@ pub(crate) fn generate_from_impl_for_enum(acc: &mut Assists, ctx: &AssistContext if field_list.fields().count() != 1 { return None; } - let field_type = field_list.fields().next()?.type_ref()?; + let field_type = field_list.fields().next()?.ty()?; let path = match field_type { ast::TypeRef::PathType(it) => it, _ => return None, -- cgit v1.2.3