From 3a26752c665111499b01c34b90aadd94afcd8b28 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 9 Jul 2020 10:03:28 +0200 Subject: Reduce API --- crates/ra_ide/src/hover.rs | 6 ++---- crates/ra_ide/src/markup.rs | 15 ++++++--------- 2 files changed, 8 insertions(+), 13 deletions(-) (limited to 'crates') diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs index 79ed30388..9b4804906 100644 --- a/crates/ra_ide/src/hover.rs +++ b/crates/ra_ide/src/hover.rs @@ -93,9 +93,7 @@ pub(crate) fn hover(db: &RootDatabase, position: FilePosition) -> Option Option for String { } } +impl From for Markup { + fn from(text: String) -> Self { + Markup { text } + } +} + impl fmt::Display for Markup { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Display::fmt(&self.text, f) @@ -26,13 +32,4 @@ impl Markup { pub fn as_str(&self) -> &str { self.text.as_str() } - pub fn is_empty(&self) -> bool { - self.text.is_empty() - } - pub fn push_section(&mut self, section: &str) { - if !self.text.is_empty() { - self.text.push_str("\n\n___\n"); - } - self.text.push_str(section); - } } -- cgit v1.2.3