diff options
Diffstat (limited to 'crates/ra_hir_ty/src/display.rs')
-rw-r--r-- | crates/ra_hir_ty/src/display.rs | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/crates/ra_hir_ty/src/display.rs b/crates/ra_hir_ty/src/display.rs index 0e9313aa1..d03bbd5a7 100644 --- a/crates/ra_hir_ty/src/display.rs +++ b/crates/ra_hir_ty/src/display.rs | |||
@@ -247,19 +247,21 @@ impl HirDisplay for ApplicationTy { | |||
247 | } | 247 | } |
248 | } | 248 | } |
249 | TypeCtor::Closure { .. } => { | 249 | TypeCtor::Closure { .. } => { |
250 | let sig = self.parameters[0] | 250 | let sig = self.parameters[0].callable_sig(f.db); |
251 | .callable_sig(f.db) | 251 | if let Some(sig) = sig { |
252 | .expect("first closure parameter should contain signature"); | 252 | if sig.params().is_empty() { |
253 | if sig.params().is_empty() { | 253 | write!(f, "||")?; |
254 | write!(f, "||")?; | 254 | } else if f.omit_verbose_types() { |
255 | } else if f.omit_verbose_types() { | 255 | write!(f, "|{}|", TYPE_HINT_TRUNCATION)?; |
256 | write!(f, "|{}|", TYPE_HINT_TRUNCATION)?; | 256 | } else { |
257 | write!(f, "|")?; | ||
258 | f.write_joined(sig.params(), ", ")?; | ||
259 | write!(f, "|")?; | ||
260 | }; | ||
261 | write!(f, " -> {}", sig.ret().display(f.db))?; | ||
257 | } else { | 262 | } else { |
258 | write!(f, "|")?; | 263 | write!(f, "{{closure}}")?; |
259 | f.write_joined(sig.params(), ", ")?; | 264 | } |
260 | write!(f, "|")?; | ||
261 | }; | ||
262 | write!(f, " -> {}", sig.ret().display(f.db))?; | ||
263 | } | 265 | } |
264 | } | 266 | } |
265 | Ok(()) | 267 | Ok(()) |