aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorKirill Bulatov <[email protected]>2019-07-21 22:47:44 +0100
committerKirill Bulatov <[email protected]>2019-07-21 22:47:44 +0100
commit25398ad30d6ffc07b3ca9ceee6a55f301973c155 (patch)
treeb3ecf44ee24d579866ccc4af1bf2e8f370514fca /crates
parentd32774b4640daf708832e7e5c3b3c62031198beb (diff)
Use SmolStr for the type text
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_ide_api/src/inlay_hints.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/crates/ra_ide_api/src/inlay_hints.rs b/crates/ra_ide_api/src/inlay_hints.rs
index 4f959f4d3..1b1f28951 100644
--- a/crates/ra_ide_api/src/inlay_hints.rs
+++ b/crates/ra_ide_api/src/inlay_hints.rs
@@ -18,7 +18,7 @@ pub struct InlayHint {
18 pub range: TextRange, 18 pub range: TextRange,
19 pub text: SmolStr, 19 pub text: SmolStr,
20 pub inlay_kind: InlayKind, 20 pub inlay_kind: InlayKind,
21 pub inlay_type_string: String, 21 pub inlay_type_string: SmolStr,
22} 22}
23 23
24pub(crate) fn inlay_hints(db: &RootDatabase, file_id: FileId, file: &SourceFile) -> Vec<InlayHint> { 24pub(crate) fn inlay_hints(db: &RootDatabase, file_id: FileId, file: &SourceFile) -> Vec<InlayHint> {
@@ -45,7 +45,8 @@ fn get_inlay_hints(
45 let let_pat = let_statement.pat()?; 45 let let_pat = let_statement.pat()?;
46 let inlay_type_string = get_node_displayable_type(db, file_id, let_syntax, &let_pat)? 46 let inlay_type_string = get_node_displayable_type(db, file_id, let_syntax, &let_pat)?
47 .display(db) 47 .display(db)
48 .to_string();; 48 .to_string()
49 .into();
49 50
50 let pat_range = match let_pat.kind() { 51 let pat_range = match let_pat.kind() {
51 PatKind::BindPat(bind_pat) => bind_pat.syntax().text_range(), 52 PatKind::BindPat(bind_pat) => bind_pat.syntax().text_range(),
@@ -74,7 +75,9 @@ fn get_inlay_hints(
74 &closure_param.pat()?, 75 &closure_param.pat()?,
75 )? 76 )?
76 .display(db) 77 .display(db)
77 .to_string(); 78 .to_string()
79 .into();
80
78 Some(InlayHint { 81 Some(InlayHint {
79 range: closure_param_syntax.text_range(), 82 range: closure_param_syntax.text_range(),
80 text: closure_param_syntax.text().to_string().into(), 83 text: closure_param_syntax.text().to_string().into(),