Skip to content

Commit 7b35da0

Browse files
committed
Improvements based on code review feedback
1 parent 9d29811 commit 7b35da0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

crates/ra_ide/src/inlay_hints.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ fn get_chaining_hints(
7676
}
7777

7878
let ty = sema.type_of_expr(&expr)?;
79-
let label = ty.display_truncated(sema.db, options.max_length).to_string();
8079
if ty.is_unknown() {
8180
return None;
8281
}
@@ -96,6 +95,7 @@ fn get_chaining_hints(
9695
let next = tokens.next()?.kind();
9796
let next_next = tokens.next()?.kind();
9897
if next == SyntaxKind::WHITESPACE && next_next == SyntaxKind::DOT {
98+
let label = ty.display_truncated(sema.db, options.max_length).to_string();
9999
acc.push(InlayHint {
100100
range: expr.syntax().text_range(),
101101
kind: InlayKind::ChainingHint,
@@ -1105,7 +1105,7 @@ fn main() {
11051105
r#"
11061106
struct A(B);
11071107
impl A { fn into_b(self) -> B { self.0 } }
1108-
struct B(C)
1108+
struct B(C);
11091109
impl B { fn into_c(self) -> C { self.0 } }
11101110
struct C;
11111111
@@ -1118,12 +1118,12 @@ fn main() {
11181118
assert_debug_snapshot!(analysis.inlay_hints(file_id, &InlayHintsOptions{ parameter_hints: false, type_hints: false, chaining_hints: true, max_length: None}).unwrap(), @r###"
11191119
[
11201120
InlayHint {
1121-
range: [231; 268),
1121+
range: [232; 269),
11221122
kind: ChainingHint,
11231123
label: "B",
11241124
},
11251125
InlayHint {
1126-
range: [231; 238),
1126+
range: [232; 239),
11271127
kind: ChainingHint,
11281128
label: "A",
11291129
},
@@ -1136,7 +1136,7 @@ fn main() {
11361136
r#"
11371137
struct A(B);
11381138
impl A { fn into_b(self) -> B { self.0 } }
1139-
struct B(C)
1139+
struct B(C);
11401140
impl B { fn into_c(self) -> C { self.0 } }
11411141
struct C;
11421142

0 commit comments

Comments
 (0)