diff options
| author | Yotam Ofek <yotam.ofek@gmail.com> | 2025-09-23 00:34:05 +0300 |
|---|---|---|
| committer | Yotam Ofek <yotam.ofek@gmail.com> | 2025-09-23 17:29:30 +0300 |
| commit | 58c7505d868515eb55971cf1ad8744c81d5ea7d2 (patch) | |
| tree | 7e3d4834268ffb0726e2444916046bb16c6205ea /src/librustdoc/html/markdown.rs | |
| parent | 40560823602064f4c726aea3e15e104449e1a392 (diff) | |
| download | rust-58c7505d868515eb55971cf1ad8744c81d5ea7d2.tar.gz rust-58c7505d868515eb55971cf1ad8744c81d5ea7d2.zip | |
Make `render_example_with_highlighting` return an `impl fmt::Display`
Diffstat (limited to 'src/librustdoc/html/markdown.rs')
| -rw-r--r-- | src/librustdoc/html/markdown.rs | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index 4addf2c3c96..46923d1f698 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -337,15 +337,14 @@ impl<'a, I: Iterator<Item = Event<'a>>> Iterator for CodeBlocks<'_, 'a, I> { // insert newline to clearly separate it from the // previous block so we can shorten the html output - let mut s = String::new(); - s.push('\n'); - - highlight::render_example_with_highlighting( - &text, - &mut s, - tooltip, - playground_button.as_deref(), - &added_classes, + let s = format!( + "\n{}", + highlight::render_example_with_highlighting( + &text, + &tooltip, + playground_button.as_deref(), + &added_classes, + ) ); Some(Event::Html(s.into())) } |
