Skip to content

Commit cec0945

Browse files
Do remove
1 parent cc0ae6a commit cec0945

File tree

2 files changed

+9
-36
lines changed

2 files changed

+9
-36
lines changed

crates/hir/src/lib.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5908,17 +5908,6 @@ impl<'db> Callable<'db> {
59085908
pub fn return_type(&self) -> Type<'db> {
59095909
self.ty.derived(self.sig.skip_binder().output())
59105910
}
5911-
pub fn async_return_type(&self, db: &'db dyn HirDatabase) -> Option<Type<'db>> {
5912-
let ret_ty = self.sig.skip_binder().output();
5913-
for pred in ret_ty.impl_trait_bounds(db).into_iter().flatten() {
5914-
if let ClauseKind::Projection(projection) = pred.kind().skip_binder()
5915-
&& let Some(output_ty) = projection.term.as_type()
5916-
{
5917-
return Some(self.ty.derived(output_ty));
5918-
}
5919-
}
5920-
None
5921-
}
59225911
pub fn sig(&self) -> impl Eq {
59235912
&self.sig
59245913
}

crates/ide/src/signature_help.rs

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -286,14 +286,15 @@ fn signature_help_for_call(
286286
}
287287
};
288288
match callable.kind() {
289-
hir::CallableKind::Function(func) if callable.return_type().contains_unknown() => {
290-
render(func.async_ret_type(db).unwrap_or_else(|| func.ret_type(db)))
291-
}
292-
hir::CallableKind::Function(_)
293-
| hir::CallableKind::Closure(_)
294-
| hir::CallableKind::FnPtr
295-
| hir::CallableKind::FnImpl(_) => {
296-
render(callable.async_return_type(db).unwrap_or_else(|| callable.return_type()))
289+
hir::CallableKind::Function(func) => render(func.async_ret_type(db).unwrap_or_else(|| {
290+
if callable.return_type().contains_unknown() {
291+
func.ret_type(db)
292+
} else {
293+
callable.return_type()
294+
}
295+
})),
296+
hir::CallableKind::Closure(_) | hir::CallableKind::FnPtr | hir::CallableKind::FnImpl(_) => {
297+
render(callable.return_type())
297298
}
298299
hir::CallableKind::TupleStruct(_) | hir::CallableKind::TupleEnumVariant(_) => {}
299300
}
@@ -2563,21 +2564,4 @@ fn main() {
25632564
"#]],
25642565
);
25652566
}
2566-
2567-
#[test]
2568-
fn test_async_closure() {
2569-
check(
2570-
r#"
2571-
//- minicore: sized, fn, future
2572-
fn main() {
2573-
let a = async move |a: i32| 2;
2574-
a($0)
2575-
}
2576-
"#,
2577-
expect![[r#"
2578-
impl AsyncFn(i32) -> impl Future<Output = i32>
2579-
^^^
2580-
"#]],
2581-
);
2582-
}
25832567
}

0 commit comments

Comments
 (0)