diff options
author | Aleksey Kladov <[email protected]> | 2020-07-09 09:03:28 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-07-09 09:03:28 +0100 |
commit | 3a26752c665111499b01c34b90aadd94afcd8b28 (patch) | |
tree | 1e091ce4bd61245c48e017ff1bbd0ce4a9dbff2f /crates/ra_ide/src/markup.rs | |
parent | 22269c67b87448a18d7772eaba0a10e595bcf50d (diff) |
Reduce API
Diffstat (limited to 'crates/ra_ide/src/markup.rs')
-rw-r--r-- | crates/ra_ide/src/markup.rs | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/crates/ra_ide/src/markup.rs b/crates/ra_ide/src/markup.rs index 2f2b3cc25..212ca80b7 100644 --- a/crates/ra_ide/src/markup.rs +++ b/crates/ra_ide/src/markup.rs | |||
@@ -16,6 +16,12 @@ impl From<Markup> for String { | |||
16 | } | 16 | } |
17 | } | 17 | } |
18 | 18 | ||
19 | impl From<String> for Markup { | ||
20 | fn from(text: String) -> Self { | ||
21 | Markup { text } | ||
22 | } | ||
23 | } | ||
24 | |||
19 | impl fmt::Display for Markup { | 25 | impl fmt::Display for Markup { |
20 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | 26 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
21 | fmt::Display::fmt(&self.text, f) | 27 | fmt::Display::fmt(&self.text, f) |
@@ -26,13 +32,4 @@ impl Markup { | |||
26 | pub fn as_str(&self) -> &str { | 32 | pub fn as_str(&self) -> &str { |
27 | self.text.as_str() | 33 | self.text.as_str() |
28 | } | 34 | } |
29 | pub fn is_empty(&self) -> bool { | ||
30 | self.text.is_empty() | ||
31 | } | ||
32 | pub fn push_section(&mut self, section: &str) { | ||
33 | if !self.text.is_empty() { | ||
34 | self.text.push_str("\n\n___\n"); | ||
35 | } | ||
36 | self.text.push_str(section); | ||
37 | } | ||
38 | } | 35 | } |