aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src
diff options
context:
space:
mode:
authorKirill Bulatov <[email protected]>2020-07-20 21:50:41 +0100
committerKirill Bulatov <[email protected]>2020-07-20 21:50:41 +0100
commit54cc3fee4550ec7e2e8b6f118de4b7ced546bc97 (patch)
tree5ff59474400febb92c4f438179af08f9c3dd1a26 /crates/ra_hir_ty/src
parent76c1fac9c3ed9fa3f784e5cdde7dd770c9fac6c1 (diff)
Do not show default types in closures
Diffstat (limited to 'crates/ra_hir_ty/src')
-rw-r--r--crates/ra_hir_ty/src/display.rs22
1 files changed, 19 insertions, 3 deletions
diff --git a/crates/ra_hir_ty/src/display.rs b/crates/ra_hir_ty/src/display.rs
index 758d5f5ac..19770e609 100644
--- a/crates/ra_hir_ty/src/display.rs
+++ b/crates/ra_hir_ty/src/display.rs
@@ -257,7 +257,12 @@ impl HirDisplay for ApplicationTy {
257 write!(f, ")")?; 257 write!(f, ")")?;
258 let ret = sig.ret(); 258 let ret = sig.ret();
259 if *ret != Ty::unit() { 259 if *ret != Ty::unit() {
260 write!(f, " -> {}", ret.display(f.db))?; 260 let ret_display = if f.omit_verbose_types() {
261 ret.display_truncated(f.db, f.max_size)
262 } else {
263 ret.display(f.db)
264 };
265 write!(f, " -> {}", ret_display)?;
261 } 266 }
262 } 267 }
263 TypeCtor::FnDef(def) => { 268 TypeCtor::FnDef(def) => {
@@ -288,7 +293,12 @@ impl HirDisplay for ApplicationTy {
288 write!(f, ")")?; 293 write!(f, ")")?;
289 let ret = sig.ret(); 294 let ret = sig.ret();
290 if *ret != Ty::unit() { 295 if *ret != Ty::unit() {
291 write!(f, " -> {}", ret.display(f.db))?; 296 let ret_display = if f.omit_verbose_types() {
297 ret.display_truncated(f.db, f.max_size)
298 } else {
299 ret.display(f.db)
300 };
301 write!(f, " -> {}", ret_display)?;
292 } 302 }
293 } 303 }
294 TypeCtor::Adt(def_id) => { 304 TypeCtor::Adt(def_id) => {
@@ -397,7 +407,13 @@ impl HirDisplay for ApplicationTy {
397 f.write_joined(sig.params(), ", ")?; 407 f.write_joined(sig.params(), ", ")?;
398 write!(f, "|")?; 408 write!(f, "|")?;
399 }; 409 };
400 write!(f, " -> {}", sig.ret().display(f.db))?; 410
411 let ret_display = if f.omit_verbose_types() {
412 sig.ret().display_truncated(f.db, f.max_size)
413 } else {
414 sig.ret().display(f.db)
415 };
416 write!(f, " -> {}", ret_display)?;
401 } else { 417 } else {
402 write!(f, "{{closure}}")?; 418 write!(f, "{{closure}}")?;
403 } 419 }