From bfd01b7f40ae2cbfe9acbc1d10e79ffe16870df8 Mon Sep 17 00:00:00 2001 From: QuietMisdreavus Date: Thu, 6 Apr 2017 18:36:14 -0500 Subject: [PATCH] rustdoc: move the space at the end of where clauses ...so that we don't indent the next line by one extra space --- src/librustdoc/html/format.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index 13a31c557021d..d9bbc957c8a2d 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -237,15 +237,23 @@ impl<'a> fmt::Display for WhereClause<'a> { clause.push(','); } } + + if end_newline { + //add a space so stripping
tags and breaking spaces still renders properly + if f.alternate() { + clause.push(' '); + } else { + clause.push_str(" "); + } + } + if !f.alternate() { clause.push_str(""); let padding = repeat(" ").take(indent + 4).collect::(); clause = clause.replace("
", &format!("
{}", padding)); clause.insert_str(0, &repeat(" ").take(indent.saturating_sub(1)) .collect::()); - if end_newline { - clause.push(' '); - } else { + if !end_newline { clause.insert_str(0, "
"); } }