Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir_ty/src/display.rs')
-rw-r--r--crates/hir_ty/src/display.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/crates/hir_ty/src/display.rs b/crates/hir_ty/src/display.rs
index adce43aa07..d1ca50c690 100644
--- a/crates/hir_ty/src/display.rs
+++ b/crates/hir_ty/src/display.rs
@@ -1162,6 +1162,16 @@ impl HirDisplay for Path {
if let Some(generic_args) = segment.args_and_bindings {
// We should be in type context, so format as `Foo<Bar>` instead of `Foo::<Bar>`.
// Do we actually format expressions?
+ if generic_args.desugared_from_fn {
+ // First argument will be a tuple, which already includes the parentheses.
+ generic_args.args[0].hir_fmt(f)?;
+ if let Some(ret) = &generic_args.bindings[0].type_ref {
+ write!(f, " -> ")?;
+ ret.hir_fmt(f)?;
+ }
+ return Ok(());
+ }
+
write!(f, "<")?;
let mut first = true;
for arg in &generic_args.args {