Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-def/src/body/pretty.rs')
-rw-r--r--crates/hir-def/src/body/pretty.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/crates/hir-def/src/body/pretty.rs b/crates/hir-def/src/body/pretty.rs
index 9aff712f4c..16e409dfe6 100644
--- a/crates/hir-def/src/body/pretty.rs
+++ b/crates/hir-def/src/body/pretty.rs
@@ -69,7 +69,9 @@ pub(super) fn print_body_hir(db: &dyn DefDatabase, body: &Body, owner: DefWithBo
p.buf.push(' ');
});
// remove the last ", " in param list
- p.buf.truncate(p.buf.len() - 2);
+ if body.params.len() > 0 {
+ p.buf.truncate(p.buf.len() - 2);
+ }
p.buf.push(')');
p.buf.push(' ');
// return type