diff options
author | Kirill Bulatov <[email protected]> | 2020-01-22 14:44:05 +0000 |
---|---|---|
committer | Kirill Bulatov <[email protected]> | 2020-01-22 14:55:09 +0000 |
commit | 4029e4410245eeb2e1f58adefad1d4cc24898579 (patch) | |
tree | 96de0273a72ddf6a434a82e9db72df942cf1c51c /crates/ra_hir_ty/src | |
parent | a5407ddc05826b208ed8a0026b2ae566bf0a8b70 (diff) |
Omit default parameters for reference types
Diffstat (limited to 'crates/ra_hir_ty/src')
-rw-r--r-- | crates/ra_hir_ty/src/display.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/lib.rs | 7 |
2 files changed, 7 insertions, 2 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 { .. } => { |