aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/display
diff options
context:
space:
mode:
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)