mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 11:31:15 +00:00
Fix formatting error when no modpath is present
This commit is contained in:
parent
5043c9ce9c
commit
910ac5a213
@ -79,14 +79,14 @@ pub(crate) fn rust_code_markup_with_doc(
|
|||||||
doc: Option<&str>,
|
doc: Option<&str>,
|
||||||
mod_path: Option<&str>,
|
mod_path: Option<&str>,
|
||||||
) -> String {
|
) -> String {
|
||||||
let mut buf = "".to_owned();
|
let mut buf = String::new();
|
||||||
|
|
||||||
if let Some(mod_path) = mod_path {
|
if let Some(mod_path) = mod_path {
|
||||||
if !mod_path.is_empty() {
|
if !mod_path.is_empty() {
|
||||||
format_to!(buf, "{}\n___\n", mod_path);
|
format_to!(buf, "{}\n___\n\n", mod_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
format_to!(buf, "```rust\n\n{}\n```", code);
|
format_to!(buf, "```rust\n{}\n```", code);
|
||||||
|
|
||||||
if let Some(doc) = doc {
|
if let Some(doc) = doc {
|
||||||
format_to!(buf, "\n\n{}", doc);
|
format_to!(buf, "\n\n{}", doc);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user