From f6bcc2d7459a3e10090391a6f9b9a2789e9cab55 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 20 Jul 2019 16:52:11 +0300 Subject: align SyntaxText API with upstream --- crates/ra_ide_api/src/display/short_label.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'crates/ra_ide_api/src/display') 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 @@ +use std::fmt::Write; + use ra_syntax::ast::{self, AstNode, NameOwner, TypeAscriptionOwner, VisibilityOwner}; pub(crate) trait ShortLabel { @@ -71,8 +73,7 @@ where let mut buf = short_label_from_node(node, prefix)?; if let Some(type_ref) = node.ascribed_type() { - buf.push_str(": "); - type_ref.syntax().text().push_to(&mut buf); + write!(buf, ": {}", type_ref.syntax()).unwrap(); } Some(buf) @@ -82,7 +83,7 @@ fn short_label_from_node(node: &T, label: &str) -> Option where T: NameOwner + VisibilityOwner, { - let mut buf = node.visibility().map(|v| format!("{} ", v.syntax().text())).unwrap_or_default(); + let mut buf = node.visibility().map(|v| format!("{} ", v.syntax())).unwrap_or_default(); buf.push_str(label); buf.push_str(node.name()?.text().as_str()); Some(buf) -- cgit v1.2.3