mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 06:41:48 +00:00
Reduce API
This commit is contained in:
parent
22269c67b8
commit
3a26752c66
2 changed files with 8 additions and 13 deletions
|
@ -16,6 +16,12 @@ impl From<Markup> for String {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<String> 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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue