From f083c868906eb863c61a751a7cd75559be4891cf Mon Sep 17 00:00:00 2001 From: Jeroen Vannevel Date: Tue, 15 Feb 2022 19:27:56 +0000 Subject: [PATCH] simplified write --- crates/hir_ty/src/display.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/crates/hir_ty/src/display.rs b/crates/hir_ty/src/display.rs index 3644bbd30d61..57439bd75e33 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) = ¶meters[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 {