|
1 |
| -use hir::{self, HasCrate, HasSource, HirDisplay}; |
| 1 | +use hir::{self, HasCrate, HasSource}; |
2 | 2 | use syntax::ast::{self, make, AstNode, HasGenericParams, HasName, HasVisibility};
|
3 | 3 |
|
4 | 4 | use crate::{
|
@@ -105,16 +105,7 @@ pub(crate) fn generate_delegate_methods(acc: &mut Assists, ctx: &AssistContext)
|
105 | 105 | arg_list,
|
106 | 106 | );
|
107 | 107 | let body = make::block_expr([], Some(tail_expr));
|
108 |
| - let ret_type = method.ret_type(ctx.db()); |
109 |
| - let ret_type = if ret_type.is_unknown() { |
110 |
| - // FIXME: we currently can't resolve certain generics, and |
111 |
| - // are returning placeholders instead. We should fix our |
112 |
| - // type resolution here, so we return fewer placeholders. |
113 |
| - Some(make::ret_type(make::ty_placeholder())) |
114 |
| - } else { |
115 |
| - let ret_type = &ret_type.display(ctx.db()).to_string(); |
116 |
| - Some(make::ret_type(make::ty(ret_type))) |
117 |
| - }; |
| 108 | + let ret_type = method_source.ret_type(); |
118 | 109 | let is_async = method_source.async_token().is_some();
|
119 | 110 | let f = make::fn_(vis, name, type_params, params, body, ret_type, is_async)
|
120 | 111 | .indent(ast::edit::IndentLevel(1))
|
@@ -314,7 +305,7 @@ struct Person<T> {
|
314 | 305 | }
|
315 | 306 |
|
316 | 307 | impl<T> Person<T> {
|
317 |
| - $0pub(crate) async fn age<J, 'a>(&'a mut self, ty: T, arg: J) -> _ { |
| 308 | + $0pub(crate) async fn age<J, 'a>(&'a mut self, ty: T, arg: J) -> T { |
318 | 309 | self.age.age(ty, arg)
|
319 | 310 | }
|
320 | 311 | }"#,
|
|
0 commit comments