aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/display
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-07-20 14:52:33 +0100
committerbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-07-20 14:52:33 +0100
commit3983ccca4ac46bb7b206a5b373b10c9822280931 (patch)
treee72c3798558b7b0494990d1c994ebd9c0f3c03f3 /crates/ra_ide_api/src/display
parentdac6adbef90286f053f034eace9df65d6a19c0ff (diff)
parentf6bcc2d7459a3e10090391a6f9b9a2789e9cab55 (diff)
Merge #1566
1566: align SyntaxText API with upstream r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
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)