Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-completion/src/completions/item_list/trait_impl.rs')
| -rw-r--r-- | crates/ide-completion/src/completions/item_list/trait_impl.rs | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/crates/ide-completion/src/completions/item_list/trait_impl.rs b/crates/ide-completion/src/completions/item_list/trait_impl.rs index cdd77e79b5..4072f05a41 100644 --- a/crates/ide-completion/src/completions/item_list/trait_impl.rs +++ b/crates/ide-completion/src/completions/item_list/trait_impl.rs @@ -344,7 +344,13 @@ fn get_transformed_fn( } _ => None, })?; - ted::replace(ty.syntax(), output.syntax()); + if let ast::Type::TupleType(ty) = &output + && ty.fields().next().is_none() + { + ted::remove(fn_.ret_type()?.syntax()); + } else { + ted::replace(ty.syntax(), output.syntax()); + } } _ => (), } @@ -1619,6 +1625,35 @@ impl DesugaredAsyncTrait for () { } "#, ); + + check_edit( + "async fn foo", + r#" +//- minicore: future, send, sized +use core::future::Future; + +trait DesugaredAsyncTrait { + fn foo(&self) -> impl Future<Output = ()> + Send; +} + +impl DesugaredAsyncTrait for () { + $0 +} +"#, + r#" +use core::future::Future; + +trait DesugaredAsyncTrait { + fn foo(&self) -> impl Future<Output = ()> + Send; +} + +impl DesugaredAsyncTrait for () { + async fn foo(&self) { + $0 +} +} +"#, + ); } #[test] |