From c2a63b97a80cb738f800da61c64e748994709c31 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Mon, 29 Mar 2021 17:46:33 +0200 Subject: Rename target_ty to self_ty --- crates/ide/src/doc_links.rs | 2 +- crates/ide/src/hover.rs | 6 +++--- crates/ide/src/references/rename.rs | 2 +- crates/ide/src/runnables.rs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'crates/ide/src') diff --git a/crates/ide/src/doc_links.rs b/crates/ide/src/doc_links.rs index 9301cdeff..4a9e8b21c 100644 --- a/crates/ide/src/doc_links.rs +++ b/crates/ide/src/doc_links.rs @@ -214,7 +214,7 @@ fn get_doc_link(db: &RootDatabase, definition: Definition) -> Option { .and_then(|assoc| match assoc.container(db) { AssocItemContainer::Trait(t) => Some(t.into()), AssocItemContainer::Impl(impld) => { - impld.target_ty(db).as_adt().map(|adt| adt.into()) + impld.self_ty(db).as_adt().map(|adt| adt.into()) } }) .unwrap_or_else(|| f.clone().into()), diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs index 3c951c507..dfd32c8c1 100644 --- a/crates/ide/src/hover.rs +++ b/crates/ide/src/hover.rs @@ -195,7 +195,7 @@ fn show_implementations_action(db: &RootDatabase, def: Definition) -> Option return it.try_to_nav(db).map(to_action), Definition::ModuleDef(ModuleDef::Adt(it)) => Some(it), - Definition::SelfType(it) => it.target_ty(db).as_adt(), + Definition::SelfType(it) => it.self_ty(db).as_adt(), _ => None, }?; adt.try_to_nav(db).map(to_action) @@ -318,7 +318,7 @@ fn definition_owner_name(db: &RootDatabase, def: &Definition) -> Option Definition::ModuleDef(md) => match md { ModuleDef::Function(f) => match f.as_assoc_item(db)?.container(db) { AssocItemContainer::Trait(t) => Some(t.name(db)), - AssocItemContainer::Impl(i) => i.target_ty(db).as_adt().map(|adt| adt.name(db)), + AssocItemContainer::Impl(i) => i.self_ty(db).as_adt().map(|adt| adt.name(db)), }, ModuleDef::Variant(e) => Some(e.parent_enum(db).name(db)), _ => None, @@ -376,7 +376,7 @@ fn hover_for_definition( }, Definition::Local(it) => hover_for_local(it, db), Definition::SelfType(impl_def) => { - impl_def.target_ty(db).as_adt().and_then(|adt| from_hir_fmt(db, adt, mod_path)) + impl_def.self_ty(db).as_adt().and_then(|adt| from_hir_fmt(db, adt, mod_path)) } Definition::GenericParam(it) => from_hir_fmt(db, it, None), Definition::Label(it) => Some(Markup::fenced_block(&it.name(db))), diff --git a/crates/ide/src/references/rename.rs b/crates/ide/src/references/rename.rs index 26d6dc9c9..98456967a 100644 --- a/crates/ide/src/references/rename.rs +++ b/crates/ide/src/references/rename.rs @@ -307,7 +307,7 @@ fn rename_to_self(sema: &Semantics, local: hir::Local) -> RenameRe hir::AssocItemContainer::Impl(impl_) => impl_, }; let first_param_ty = first_param.ty(); - let impl_ty = impl_.target_ty(sema.db); + let impl_ty = impl_.self_ty(sema.db); let (ty, self_param) = if impl_ty.remove_ref().is_some() { // if the impl is a ref to the type we can just match the `&T` with self directly (first_param_ty.clone(), "self") diff --git a/crates/ide/src/runnables.rs b/crates/ide/src/runnables.rs index 7e4c5a078..11bd385bb 100644 --- a/crates/ide/src/runnables.rs +++ b/crates/ide/src/runnables.rs @@ -298,7 +298,7 @@ fn module_def_doctest(sema: &Semantics, def: hir::ModuleDef) -> Op // FIXME: this also looks very wrong if let Some(assoc_def) = assoc_def { if let hir::AssocItemContainer::Impl(imp) = assoc_def.container(sema.db) { - let ty = imp.target_ty(sema.db); + let ty = imp.self_ty(sema.db); if let Some(adt) = ty.as_adt() { let name = adt.name(sema.db); let idx = path.rfind(':').map_or(0, |idx| idx + 1); -- cgit v1.2.3