aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_hir_ty/src/display.rs2
-rw-r--r--crates/ra_hir_ty/src/lib.rs7
-rw-r--r--crates/ra_ide/src/inlay_hints.rs14
3 files changed, 20 insertions, 3 deletions
diff --git a/crates/ra_hir_ty/src/display.rs b/crates/ra_hir_ty/src/display.rs
index 37def7c03..d1ff85f0f 100644
--- a/crates/ra_hir_ty/src/display.rs
+++ b/crates/ra_hir_ty/src/display.rs
@@ -9,7 +9,7 @@ pub struct HirFormatter<'a, 'b, DB> {
9 fmt: &'a mut fmt::Formatter<'b>, 9 fmt: &'a mut fmt::Formatter<'b>,
10 buf: String, 10 buf: String,
11 curr_size: usize, 11 curr_size: usize,
12 max_size: Option<usize>, 12 pub(crate) max_size: Option<usize>,
13 omit_verbose_types: bool, 13 omit_verbose_types: bool,
14} 14}
15 15
diff --git a/crates/ra_hir_ty/src/lib.rs b/crates/ra_hir_ty/src/lib.rs
index d63f862dc..908e4862d 100644
--- a/crates/ra_hir_ty/src/lib.rs
+++ b/crates/ra_hir_ty/src/lib.rs
@@ -855,7 +855,12 @@ impl HirDisplay for ApplicationTy {
855 } 855 }
856 TypeCtor::Ref(m) => { 856 TypeCtor::Ref(m) => {
857 let t = self.parameters.as_single(); 857 let t = self.parameters.as_single();
858 write!(f, "&{}{}", m.as_keyword_for_ref(), t.display(f.db))?; 858 let ty_display = if f.omit_verbose_types() {
859 t.display_truncated(f.db, f.max_size)
860 } else {
861 t.display(f.db)
862 };
863 write!(f, "&{}{}", m.as_keyword_for_ref(), ty_display)?;
859 } 864 }
860 TypeCtor::Never => write!(f, "!")?, 865 TypeCtor::Never => write!(f, "!")?,
861 TypeCtor::Tuple { .. } => { 866 TypeCtor::Tuple { .. } => {
diff --git a/crates/ra_ide/src/inlay_hints.rs b/crates/ra_ide/src/inlay_hints.rs
index 236557541..393ca9447 100644
--- a/crates/ra_ide/src/inlay_hints.rs
+++ b/crates/ra_ide/src/inlay_hints.rs
@@ -245,6 +245,7 @@ struct Test<K, T = u8> {
245 245
246fn main() { 246fn main() {
247 let zz = Test { t: 23, k: 33 }; 247 let zz = Test { t: 23, k: 33 };
248 let zz_ref = &zz;
248}"#, 249}"#,
249 ); 250 );
250 251
@@ -255,6 +256,11 @@ fn main() {
255 kind: TypeHint, 256 kind: TypeHint,
256 label: "Test<i32>", 257 label: "Test<i32>",
257 }, 258 },
259 InlayHint {
260 range: [105; 111),
261 kind: TypeHint,
262 label: "&Test<i32>",
263 },
258 ] 264 ]
259 "### 265 "###
260 ); 266 );
@@ -374,6 +380,7 @@ fn main() {
374 380
375 let multiply = |a, b, c, d| a * b * c * d; 381 let multiply = |a, b, c, d| a * b * c * d;
376 let _: i32 = multiply(1, 2, 3, 4); 382 let _: i32 = multiply(1, 2, 3, 4);
383 let multiply_ref = &multiply;
377 384
378 let return_42 = || 42; 385 let return_42 = || 42;
379}"#, 386}"#,
@@ -417,7 +424,12 @@ fn main() {
417 label: "i32", 424 label: "i32",
418 }, 425 },
419 InlayHint { 426 InlayHint {
420 range: [201; 210), 427 range: [200; 212),
428 kind: TypeHint,
429 label: "&|…| -> i32",
430 },
431 InlayHint {
432 range: [235; 244),
421 kind: TypeHint, 433 kind: TypeHint,
422 label: "|| -> i32", 434 label: "|| -> i32",
423 }, 435 },