diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_ide/src/inlay_hints.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/ra_ide/src/inlay_hints.rs b/crates/ra_ide/src/inlay_hints.rs index 07aab45ee..f4f0751c0 100644 --- a/crates/ra_ide/src/inlay_hints.rs +++ b/crates/ra_ide/src/inlay_hints.rs | |||
@@ -76,7 +76,6 @@ fn get_chaining_hints( | |||
76 | } | 76 | } |
77 | 77 | ||
78 | let ty = sema.type_of_expr(&expr)?; | 78 | let ty = sema.type_of_expr(&expr)?; |
79 | let label = ty.display_truncated(sema.db, options.max_length).to_string(); | ||
80 | if ty.is_unknown() { | 79 | if ty.is_unknown() { |
81 | return None; | 80 | return None; |
82 | } | 81 | } |
@@ -96,6 +95,7 @@ fn get_chaining_hints( | |||
96 | let next = tokens.next()?.kind(); | 95 | let next = tokens.next()?.kind(); |
97 | let next_next = tokens.next()?.kind(); | 96 | let next_next = tokens.next()?.kind(); |
98 | if next == SyntaxKind::WHITESPACE && next_next == SyntaxKind::DOT { | 97 | if next == SyntaxKind::WHITESPACE && next_next == SyntaxKind::DOT { |
98 | let label = ty.display_truncated(sema.db, options.max_length).to_string(); | ||
99 | acc.push(InlayHint { | 99 | acc.push(InlayHint { |
100 | range: expr.syntax().text_range(), | 100 | range: expr.syntax().text_range(), |
101 | kind: InlayKind::ChainingHint, | 101 | kind: InlayKind::ChainingHint, |
@@ -1105,7 +1105,7 @@ fn main() { | |||
1105 | r#" | 1105 | r#" |
1106 | struct A(B); | 1106 | struct A(B); |
1107 | impl A { fn into_b(self) -> B { self.0 } } | 1107 | impl A { fn into_b(self) -> B { self.0 } } |
1108 | struct B(C) | 1108 | struct B(C); |
1109 | impl B { fn into_c(self) -> C { self.0 } } | 1109 | impl B { fn into_c(self) -> C { self.0 } } |
1110 | struct C; | 1110 | struct C; |
1111 | 1111 | ||
@@ -1118,12 +1118,12 @@ fn main() { | |||
1118 | assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayHintsOptions{ parameter_hints: false, type_hints: false, chaining_hints: true, max_length: None}).unwrap(), @r###" | 1118 | assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayHintsOptions{ parameter_hints: false, type_hints: false, chaining_hints: true, max_length: None}).unwrap(), @r###" |
1119 | [ | 1119 | [ |
1120 | InlayHint { | 1120 | InlayHint { |
1121 | range: [231; 268), | 1121 | range: [232; 269), |
1122 | kind: ChainingHint, | 1122 | kind: ChainingHint, |
1123 | label: "B", | 1123 | label: "B", |
1124 | }, | 1124 | }, |
1125 | InlayHint { | 1125 | InlayHint { |
1126 | range: [231; 238), | 1126 | range: [232; 239), |
1127 | kind: ChainingHint, | 1127 | kind: ChainingHint, |
1128 | label: "A", | 1128 | label: "A", |
1129 | }, | 1129 | }, |
@@ -1136,7 +1136,7 @@ fn main() { | |||
1136 | r#" | 1136 | r#" |
1137 | struct A(B); | 1137 | struct A(B); |
1138 | impl A { fn into_b(self) -> B { self.0 } } | 1138 | impl A { fn into_b(self) -> B { self.0 } } |
1139 | struct B(C) | 1139 | struct B(C); |
1140 | impl B { fn into_c(self) -> C { self.0 } } | 1140 | impl B { fn into_c(self) -> C { self.0 } } |
1141 | struct C; | 1141 | struct C; |
1142 | 1142 | ||