diff --git a/crates/hir_ty/src/display.rs b/crates/hir_ty/src/display.rs index 377821b3761..3644bbd30d6 100644 --- a/crates/hir_ty/src/display.rs +++ b/crates/hir_ty/src/display.rs @@ -1115,12 +1115,13 @@ impl HirDisplay for TypeRef { write!(f, "{}...", if parameters.len() == 1 { "" } else { ", " })?; } write!(f, ")")?; - let ret_ty = ¶meters.last().unwrap().1; - match ret_ty { - TypeRef::Tuple(tup) if tup.is_empty() => {} - _ => { - write!(f, " -> ")?; - ret_ty.hir_fmt(f)?; + if let Some((_, ret_ty)) = ¶meters.last() { + match ret_ty { + TypeRef::Tuple(tup) if tup.is_empty() => {} + _ => { + write!(f, " -> ")?; + ret_ty.hir_fmt(f)?; + } } } }