Unnamed repository; edit this file 'description' to name the repository.
removed unwrap
| -rw-r--r-- | crates/hir_ty/src/display.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/crates/hir_ty/src/display.rs b/crates/hir_ty/src/display.rs index 377821b376..3644bbd30d 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)?; + } } } } |