diff options
Diffstat (limited to 'crates/ide/src/inlay_hints.rs')
-rw-r--r-- | crates/ide/src/inlay_hints.rs | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/crates/ide/src/inlay_hints.rs b/crates/ide/src/inlay_hints.rs index 65df7979c..fe60abfc8 100644 --- a/crates/ide/src/inlay_hints.rs +++ b/crates/ide/src/inlay_hints.rs | |||
@@ -18,12 +18,6 @@ pub struct InlayHintsConfig { | |||
18 | pub max_length: Option<usize>, | 18 | pub max_length: Option<usize>, |
19 | } | 19 | } |
20 | 20 | ||
21 | impl Default for InlayHintsConfig { | ||
22 | fn default() -> Self { | ||
23 | Self { type_hints: true, parameter_hints: true, chaining_hints: true, max_length: None } | ||
24 | } | ||
25 | } | ||
26 | |||
27 | #[derive(Clone, Debug, PartialEq, Eq)] | 21 | #[derive(Clone, Debug, PartialEq, Eq)] |
28 | pub enum InlayKind { | 22 | pub enum InlayKind { |
29 | TypeHint, | 23 | TypeHint, |
@@ -433,8 +427,15 @@ mod tests { | |||
433 | 427 | ||
434 | use crate::{fixture, inlay_hints::InlayHintsConfig}; | 428 | use crate::{fixture, inlay_hints::InlayHintsConfig}; |
435 | 429 | ||
430 | const TEST_CONFIG: InlayHintsConfig = InlayHintsConfig { | ||
431 | type_hints: true, | ||
432 | parameter_hints: true, | ||
433 | chaining_hints: true, | ||
434 | max_length: None, | ||
435 | }; | ||
436 | |||
436 | fn check(ra_fixture: &str) { | 437 | fn check(ra_fixture: &str) { |
437 | check_with_config(InlayHintsConfig::default(), ra_fixture); | 438 | check_with_config(TEST_CONFIG, ra_fixture); |
438 | } | 439 | } |
439 | 440 | ||
440 | fn check_with_config(config: InlayHintsConfig, ra_fixture: &str) { | 441 | fn check_with_config(config: InlayHintsConfig, ra_fixture: &str) { |
@@ -748,7 +749,7 @@ fn main() { | |||
748 | #[test] | 749 | #[test] |
749 | fn hint_truncation() { | 750 | fn hint_truncation() { |
750 | check_with_config( | 751 | check_with_config( |
751 | InlayHintsConfig { max_length: Some(8), ..Default::default() }, | 752 | InlayHintsConfig { max_length: Some(8), ..TEST_CONFIG }, |
752 | r#" | 753 | r#" |
753 | struct Smol<T>(T); | 754 | struct Smol<T>(T); |
754 | 755 | ||
@@ -831,7 +832,7 @@ fn main() { | |||
831 | #[test] | 832 | #[test] |
832 | fn omitted_parameters_hints_heuristics() { | 833 | fn omitted_parameters_hints_heuristics() { |
833 | check_with_config( | 834 | check_with_config( |
834 | InlayHintsConfig { max_length: Some(8), ..Default::default() }, | 835 | InlayHintsConfig { max_length: Some(8), ..TEST_CONFIG }, |
835 | r#" | 836 | r#" |
836 | fn map(f: i32) {} | 837 | fn map(f: i32) {} |
837 | fn filter(predicate: i32) {} | 838 | fn filter(predicate: i32) {} |
@@ -924,7 +925,7 @@ fn main() { | |||
924 | #[test] | 925 | #[test] |
925 | fn unit_structs_have_no_type_hints() { | 926 | fn unit_structs_have_no_type_hints() { |
926 | check_with_config( | 927 | check_with_config( |
927 | InlayHintsConfig { max_length: Some(8), ..Default::default() }, | 928 | InlayHintsConfig { max_length: Some(8), ..TEST_CONFIG }, |
928 | r#" | 929 | r#" |
929 | enum Result<T, E> { Ok(T), Err(E) } | 930 | enum Result<T, E> { Ok(T), Err(E) } |
930 | use Result::*; | 931 | use Result::*; |