diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-03-30 17:45:05 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-03-30 17:45:05 +0100 |
commit | fd7c454d516e3af90d8c0d0d8a22655345fec2d7 (patch) | |
tree | 6e5292a731c7039d92c636bc66a27714845ffb1c /crates/ide_assists | |
parent | 277db63a08d9910ffbcf1eded723c176941feff1 (diff) | |
parent | b4bb7743810b1e6ac8b897a465c430e9ed8d5c44 (diff) |
Merge #8186
8186: Lower traits to `TraitRef` instead of `TypeRef` r=matklad a=Veykril
Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/ide_assists')
-rw-r--r-- | crates/ide_assists/src/handlers/generate_default_from_new.rs | 2 | ||||
-rw-r--r-- | crates/ide_assists/src/handlers/generate_is_empty_from_len.rs | 2 | ||||
-rw-r--r-- | crates/ide_assists/src/utils.rs | 4 |
3 files changed, 4 insertions, 4 deletions
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 { | |||
92 | None => return false, | 92 | None => return false, |
93 | }; | 93 | }; |
94 | 94 | ||
95 | let ty = impl_def.target_ty(db); | 95 | let ty = impl_def.self_ty(db); |
96 | let krate = impl_def.module(db).krate(); | 96 | let krate = impl_def.module(db).krate(); |
97 | let default = FamousDefs(&ctx.sema, Some(krate)).core_default_Default(); | 97 | let default = FamousDefs(&ctx.sema, Some(krate)).core_default_Default(); |
98 | let default_trait = match default { | 98 | 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( | |||
91 | 91 | ||
92 | let scope = ctx.sema.scope(impl_.syntax()); | 92 | let scope = ctx.sema.scope(impl_.syntax()); |
93 | let krate = impl_def.module(db).krate(); | 93 | let krate = impl_def.module(db).krate(); |
94 | let ty = impl_def.target_ty(db); | 94 | let ty = impl_def.self_ty(db); |
95 | let traits_in_scope = scope.traits_in_scope(); | 95 | let traits_in_scope = scope.traits_in_scope(); |
96 | ty.iterate_method_candidates(db, krate, &traits_in_scope, Some(fn_name), |_, func| Some(func)) | 96 | ty.iterate_method_candidates(db, krate, &traits_in_scope, Some(fn_name), |_, func| Some(func)) |
97 | } | 97 | } |
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( | |||
338 | // (we currently use the wrong type parameter) | 338 | // (we currently use the wrong type parameter) |
339 | // also we wouldn't want to use e.g. `impl S<u32>` | 339 | // also we wouldn't want to use e.g. `impl S<u32>` |
340 | 340 | ||
341 | let same_ty = match blk.target_ty(db).as_adt() { | 341 | let same_ty = match blk.self_ty(db).as_adt() { |
342 | Some(def) => def == struct_def, | 342 | Some(def) => def == struct_def, |
343 | None => false, | 343 | None => false, |
344 | }; | 344 | }; |
345 | let not_trait_impl = blk.target_trait(db).is_none(); | 345 | let not_trait_impl = blk.trait_(db).is_none(); |
346 | 346 | ||
347 | if !(same_ty && not_trait_impl) { | 347 | if !(same_ty && not_trait_impl) { |
348 | None | 348 | None |