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_assists/src/handlers/generate_default_from_new.rs | 2 +- crates/ide_assists/src/handlers/generate_is_empty_from_len.rs | 2 +- crates/ide_assists/src/utils.rs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'crates/ide_assists/src') diff --git a/crates/ide_assists/src/handlers/generate_default_from_new.rs b/crates/ide_assists/src/handlers/generate_default_from_new.rs index 81c54ba3e..dc14552d6 100644 --- a/crates/ide_assists/src/handlers/generate_default_from_new.rs +++ b/crates/ide_assists/src/handlers/generate_default_from_new.rs @@ -92,7 +92,7 @@ fn is_default_implemented(ctx: &AssistContext, impl_: &Impl) -> bool { None => return false, }; - let ty = impl_def.target_ty(db); + let ty = impl_def.self_ty(db); let krate = impl_def.module(db).krate(); let default = FamousDefs(&ctx.sema, Some(krate)).core_default_Default(); let default_trait = match default { diff --git a/crates/ide_assists/src/handlers/generate_is_empty_from_len.rs b/crates/ide_assists/src/handlers/generate_is_empty_from_len.rs index b8834d283..910010a04 100644 --- a/crates/ide_assists/src/handlers/generate_is_empty_from_len.rs +++ b/crates/ide_assists/src/handlers/generate_is_empty_from_len.rs @@ -91,7 +91,7 @@ fn get_impl_method( let scope = ctx.sema.scope(impl_.syntax()); let krate = impl_def.module(db).krate(); - let ty = impl_def.target_ty(db); + let ty = impl_def.self_ty(db); let traits_in_scope = scope.traits_in_scope(); ty.iterate_method_candidates(db, krate, &traits_in_scope, Some(fn_name), |_, func| Some(func)) } diff --git a/crates/ide_assists/src/utils.rs b/crates/ide_assists/src/utils.rs index 5f630ec75..d67524937 100644 --- a/crates/ide_assists/src/utils.rs +++ b/crates/ide_assists/src/utils.rs @@ -338,11 +338,11 @@ pub(crate) fn find_struct_impl( // (we currently use the wrong type parameter) // also we wouldn't want to use e.g. `impl S` - let same_ty = match blk.target_ty(db).as_adt() { + let same_ty = match blk.self_ty(db).as_adt() { Some(def) => def == struct_def, None => false, }; - let not_trait_impl = blk.target_trait(db).is_none(); + let not_trait_impl = blk.trait_(db).is_none(); if !(same_ty && not_trait_impl) { None -- cgit v1.2.3