Unnamed repository; edit this file 'description' to name the repository.
simplified write
Jeroen Vannevel 2022-02-16
parent 842ffde · commit f083c86
-rw-r--r--crates/hir_ty/src/display.rs12
1 files changed, 5 insertions, 7 deletions
diff --git a/crates/hir_ty/src/display.rs b/crates/hir_ty/src/display.rs
index 3644bbd30d..57439bd75e 100644
--- a/crates/hir_ty/src/display.rs
+++ b/crates/hir_ty/src/display.rs
@@ -1098,13 +1098,11 @@ impl HirDisplay for TypeRef {
write!(f, "fn(")?;
for index in 0..parameters.len() - 1 {
let (param_name, param_type) = &parameters[index];
- match param_name {
- Some(name) => {
- write!(f, "{}: ", name)?;
- param_type.hir_fmt(f)?;
- }
- None => param_type.hir_fmt(f)?,
- };
+ if let Some(name) = param_name {
+ write!(f, "{}: ", name)?;
+ }
+
+ param_type.hir_fmt(f)?;
// Last index contains the return type so we stop writing commas on the second-to-last index
if index != parameters.len() - 2 {