Skip to content

Commit 58f66a1

Browse files
authored
Merge pull request #1375 from dtolnay/playground
Fix stray spacing after #playground code
2 parents 643d5ec + 1450070 commit 58f66a1

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/preprocess/links.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,16 +335,19 @@ impl<'a> Link<'a> {
335335
LinkType::Playground(ref pat, ref attrs) => {
336336
let target = base.join(pat);
337337

338-
let contents = fs::read_to_string(&target).with_context(|| {
338+
let mut contents = fs::read_to_string(&target).with_context(|| {
339339
format!(
340340
"Could not read file for link {} ({})",
341341
self.link_text,
342342
target.display()
343343
)
344344
})?;
345345
let ftype = if !attrs.is_empty() { "rust," } else { "rust" };
346+
if !contents.ends_with('\n') {
347+
contents.push('\n');
348+
}
346349
Ok(format!(
347-
"```{}{}\n{}\n```\n",
350+
"```{}{}\n{}```\n",
348351
ftype,
349352
attrs.join(","),
350353
contents

0 commit comments

Comments
 (0)