Skip to content

Commit 5e3e9c4

Browse files
authored
Merge pull request #21222 from A4-Tacks/no-comp-resugar-unit-ret-ty
No complete unit RetType in resugar async assoc item
2 parents 6dd5f16 + 5955a29 commit 5e3e9c4

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

crates/ide-completion/src/completions/item_list/trait_impl.rs

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,13 @@ fn get_transformed_fn(
344344
}
345345
_ => None,
346346
})?;
347-
ted::replace(ty.syntax(), output.syntax());
347+
if let ast::Type::TupleType(ty) = &output
348+
&& ty.fields().next().is_none()
349+
{
350+
ted::remove(fn_.ret_type()?.syntax());
351+
} else {
352+
ted::replace(ty.syntax(), output.syntax());
353+
}
348354
}
349355
_ => (),
350356
}
@@ -1617,6 +1623,35 @@ impl DesugaredAsyncTrait for () {
16171623
$0
16181624
}
16191625
}
1626+
"#,
1627+
);
1628+
1629+
check_edit(
1630+
"async fn foo",
1631+
r#"
1632+
//- minicore: future, send, sized
1633+
use core::future::Future;
1634+
1635+
trait DesugaredAsyncTrait {
1636+
fn foo(&self) -> impl Future<Output = ()> + Send;
1637+
}
1638+
1639+
impl DesugaredAsyncTrait for () {
1640+
$0
1641+
}
1642+
"#,
1643+
r#"
1644+
use core::future::Future;
1645+
1646+
trait DesugaredAsyncTrait {
1647+
fn foo(&self) -> impl Future<Output = ()> + Send;
1648+
}
1649+
1650+
impl DesugaredAsyncTrait for () {
1651+
async fn foo(&self) {
1652+
$0
1653+
}
1654+
}
16201655
"#,
16211656
);
16221657
}

0 commit comments

Comments
 (0)