diff options
author | Aleksey Kladov <[email protected]> | 2020-01-16 15:27:21 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-01-16 15:27:21 +0000 |
commit | a3d6ddbe694498a1bf69c6253422efb89431164e (patch) | |
tree | ced08cf46f2f822abc630b6935ec5ecf4ee4dc0d /crates/ra_assists/src/assists | |
parent | 8691ae8ac04ef9dc089a377770da86a952b0e4c1 (diff) |
More natural trait setup
Diffstat (limited to 'crates/ra_assists/src/assists')
-rw-r--r-- | crates/ra_assists/src/assists/add_new.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/ra_assists/src/assists/add_new.rs b/crates/ra_assists/src/assists/add_new.rs index aedcd6286..8db63f762 100644 --- a/crates/ra_assists/src/assists/add_new.rs +++ b/crates/ra_assists/src/assists/add_new.rs | |||
@@ -140,12 +140,12 @@ fn find_struct_impl( | |||
140 | 140 | ||
141 | let struct_ty = { | 141 | let struct_ty = { |
142 | let src = InFile { file_id: ctx.frange.file_id.into(), value: strukt.clone() }; | 142 | let src = InFile { file_id: ctx.frange.file_id.into(), value: strukt.clone() }; |
143 | sb.to_def::<hir::Struct, _>(src)?.ty(db) | 143 | sb.to_def(src)?.ty(db) |
144 | }; | 144 | }; |
145 | 145 | ||
146 | let block = module.descendants().filter_map(ast::ImplBlock::cast).find_map(|impl_blk| { | 146 | let block = module.descendants().filter_map(ast::ImplBlock::cast).find_map(|impl_blk| { |
147 | let src = InFile { file_id: ctx.frange.file_id.into(), value: impl_blk.clone() }; | 147 | let src = InFile { file_id: ctx.frange.file_id.into(), value: impl_blk.clone() }; |
148 | let blk = sb.to_def::<hir::ImplBlock, _>(src)?; | 148 | let blk = sb.to_def(src)?; |
149 | 149 | ||
150 | let same_ty = blk.target_ty(db) == struct_ty; | 150 | let same_ty = blk.target_ty(db) == struct_ty; |
151 | let not_trait_impl = blk.target_trait(db).is_none(); | 151 | let not_trait_impl = blk.target_trait(db).is_none(); |