aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src/handlers/generate_new.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_assists/src/handlers/generate_new.rs')
-rw-r--r--crates/ra_assists/src/handlers/generate_new.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/ra_assists/src/handlers/generate_new.rs b/crates/ra_assists/src/handlers/generate_new.rs
index 22b47d254..3c67749ee 100644
--- a/crates/ra_assists/src/handlers/generate_new.rs
+++ b/crates/ra_assists/src/handlers/generate_new.rs
@@ -122,7 +122,7 @@ fn generate_impl_text(strukt: &ast::Struct, code: &str) -> String {
122// 122//
123// FIXME: change the new fn checking to a more semantic approach when that's more 123// FIXME: change the new fn checking to a more semantic approach when that's more
124// viable (e.g. we process proc macros, etc) 124// viable (e.g. we process proc macros, etc)
125fn find_struct_impl(ctx: &AssistContext, strukt: &ast::Struct) -> Option<Option<ast::ImplDef>> { 125fn find_struct_impl(ctx: &AssistContext, strukt: &ast::Struct) -> Option<Option<ast::Impl>> {
126 let db = ctx.db(); 126 let db = ctx.db();
127 let module = strukt.syntax().ancestors().find(|node| { 127 let module = strukt.syntax().ancestors().find(|node| {
128 ast::Module::can_cast(node.kind()) || ast::SourceFile::can_cast(node.kind()) 128 ast::Module::can_cast(node.kind()) || ast::SourceFile::can_cast(node.kind())
@@ -130,7 +130,7 @@ fn find_struct_impl(ctx: &AssistContext, strukt: &ast::Struct) -> Option<Option<
130 130
131 let struct_def = ctx.sema.to_def(strukt)?; 131 let struct_def = ctx.sema.to_def(strukt)?;
132 132
133 let block = module.descendants().filter_map(ast::ImplDef::cast).find_map(|impl_blk| { 133 let block = module.descendants().filter_map(ast::Impl::cast).find_map(|impl_blk| {
134 let blk = ctx.sema.to_def(&impl_blk)?; 134 let blk = ctx.sema.to_def(&impl_blk)?;
135 135
136 // FIXME: handle e.g. `struct S<T>; impl<U> S<U> {}` 136 // FIXME: handle e.g. `struct S<T>; impl<U> S<U> {}`
@@ -158,7 +158,7 @@ fn find_struct_impl(ctx: &AssistContext, strukt: &ast::Struct) -> Option<Option<
158 Some(block) 158 Some(block)
159} 159}
160 160
161fn has_new_fn(imp: &ast::ImplDef) -> bool { 161fn has_new_fn(imp: &ast::Impl) -> bool {
162 if let Some(il) = imp.assoc_item_list() { 162 if let Some(il) = imp.assoc_item_list() {
163 for item in il.assoc_items() { 163 for item in il.assoc_items() {
164 if let ast::AssocItem::Fn(f) = item { 164 if let ast::AssocItem::Fn(f) = item {