diff options
author | Kirill Bulatov <[email protected]> | 2020-07-20 21:50:41 +0100 |
---|---|---|
committer | Kirill Bulatov <[email protected]> | 2020-07-20 21:50:41 +0100 |
commit | 54cc3fee4550ec7e2e8b6f118de4b7ced546bc97 (patch) | |
tree | 5ff59474400febb92c4f438179af08f9c3dd1a26 | |
parent | 76c1fac9c3ed9fa3f784e5cdde7dd770c9fac6c1 (diff) |
Do not show default types in closures
-rw-r--r-- | crates/ra_hir_ty/src/display.rs | 22 | ||||
-rw-r--r-- | crates/ra_ide/src/inlay_hints.rs | 2 |
2 files changed, 21 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 | } |
diff --git a/crates/ra_ide/src/inlay_hints.rs b/crates/ra_ide/src/inlay_hints.rs index 09883ab4d..f2e4f7ee5 100644 --- a/crates/ra_ide/src/inlay_hints.rs +++ b/crates/ra_ide/src/inlay_hints.rs | |||
@@ -425,6 +425,8 @@ fn main() { | |||
425 | //^^ Test<i32> | 425 | //^^ Test<i32> |
426 | let zz_ref = &zz; | 426 | let zz_ref = &zz; |
427 | //^^^^^^ &Test<i32> | 427 | //^^^^^^ &Test<i32> |
428 | let test = || zz; | ||
429 | //^^^^ || -> Test<i32> | ||
428 | }"#, | 430 | }"#, |
429 | ); | 431 | ); |
430 | } | 432 | } |