about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorQuietMisdreavus <grey@quietmisdreavus.net>2017-04-06 18:36:14 -0500
committerQuietMisdreavus <grey@quietmisdreavus.net>2017-04-06 18:36:14 -0500
commitbfd01b7f40ae2cbfe9acbc1d10e79ffe16870df8 (patch)
tree6590dbeb4d06a4f5d7f9990976e3a0c18d3dd9c5 /src
parentae0e45c02808551ec27ed940fad9a05cd9bcbaed (diff)
downloadrust-bfd01b7f40ae2cbfe9acbc1d10e79ffe16870df8.tar.gz
rust-bfd01b7f40ae2cbfe9acbc1d10e79ffe16870df8.zip
rustdoc: move the space at the end of where clauses
...so that we don't indent the next line by one extra space
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/html/format.rs14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs
index 13a31c55702..d9bbc957c8a 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 <br> tags and breaking spaces still renders properly
+            if f.alternate() {
+                clause.push(' ');
+            } else {
+                clause.push_str("&nbsp;");
+            }
+        }
+
         if !f.alternate() {
             clause.push_str("</span>");
             let padding = repeat("&nbsp;").take(indent + 4).collect::<String>();
             clause = clause.replace("<br>", &format!("<br>{}", padding));
             clause.insert_str(0, &repeat("&nbsp;").take(indent.saturating_sub(1))
                                                   .collect::<String>());
-            if end_newline {
-                clause.push(' ');
-            } else {
+            if !end_newline {
                 clause.insert_str(0, "<br>");
             }
         }