aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/display
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-07-20 14:52:11 +0100
committerAleksey Kladov <[email protected]>2019-07-20 14:52:11 +0100
commitf6bcc2d7459a3e10090391a6f9b9a2789e9cab55 (patch)
tree742f34cb6e1e38f1e009c23405fc2d3c6a232f72 /crates/ra_ide_api/src/display
parent6b352ffeb346eb7c7e46e00e790c2f395907eaa6 (diff)
align SyntaxText API with upstream
Diffstat (limited to 'crates/ra_ide_api/src/display')
-rw-r--r--crates/ra_ide_api/src/display/short_label.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/crates/ra_ide_api/src/display/short_label.rs b/crates/ra_ide_api/src/display/short_label.rs
index f926f631f..be499e485 100644
--- a/crates/ra_ide_api/src/display/short_label.rs
+++ b/crates/ra_ide_api/src/display/short_label.rs
@@ -1,3 +1,5 @@
1use std::fmt::Write;
2
1use ra_syntax::ast::{self, AstNode, NameOwner, TypeAscriptionOwner, VisibilityOwner}; 3use ra_syntax::ast::{self, AstNode, NameOwner, TypeAscriptionOwner, VisibilityOwner};
2 4
3pub(crate) trait ShortLabel { 5pub(crate) trait ShortLabel {
@@ -71,8 +73,7 @@ where
71 let mut buf = short_label_from_node(node, prefix)?; 73 let mut buf = short_label_from_node(node, prefix)?;
72 74
73 if let Some(type_ref) = node.ascribed_type() { 75 if let Some(type_ref) = node.ascribed_type() {
74 buf.push_str(": "); 76 write!(buf, ": {}", type_ref.syntax()).unwrap();
75 type_ref.syntax().text().push_to(&mut buf);
76 } 77 }
77 78
78 Some(buf) 79 Some(buf)
@@ -82,7 +83,7 @@ fn short_label_from_node<T>(node: &T, label: &str) -> Option<String>
82where 83where
83 T: NameOwner + VisibilityOwner, 84 T: NameOwner + VisibilityOwner,
84{ 85{
85 let mut buf = node.visibility().map(|v| format!("{} ", v.syntax().text())).unwrap_or_default(); 86 let mut buf = node.visibility().map(|v| format!("{} ", v.syntax())).unwrap_or_default();
86 buf.push_str(label); 87 buf.push_str(label);
87 buf.push_str(node.name()?.text().as_str()); 88 buf.push_str(node.name()?.text().as_str());
88 Some(buf) 89 Some(buf)