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 cdd77e79b5cd..4072f05a41f4 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()); + } } _ => (), } @@ -1617,6 +1623,35 @@ impl DesugaredAsyncTrait for () { $0 } } +"#, + ); + + check_edit( + "async fn foo", + r#" +//- minicore: future, send, sized +use core::future::Future; + +trait DesugaredAsyncTrait { + fn foo(&self) -> impl Future + Send; +} + +impl DesugaredAsyncTrait for () { + $0 +} +"#, + r#" +use core::future::Future; + +trait DesugaredAsyncTrait { + fn foo(&self) -> impl Future + Send; +} + +impl DesugaredAsyncTrait for () { + async fn foo(&self) { + $0 +} +} "#, ); }