about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/html/format.rs12
-rw-r--r--src/librustdoc/html/render/print_item.rs20
-rw-r--r--src/librustdoc/html/static/css/rustdoc.css1
3 files changed, 21 insertions, 12 deletions
diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs
index 74cdf9b9b79..a59cfbea885 100644
--- a/src/librustdoc/html/format.rs
+++ b/src/librustdoc/html/format.rs
@@ -353,7 +353,11 @@ pub(crate) fn print_where_clause<'a, 'tcx: 'a>(
         } else {
             let mut br_with_padding = String::with_capacity(6 * indent + 28);
             br_with_padding.push_str("<br>");
-            for _ in 0..indent + 4 {
+
+            let padding_amout =
+                if ending == Ending::Newline { indent + 4 } else { indent + "fn where ".len() };
+
+            for _ in 0..padding_amout {
                 br_with_padding.push_str(" ");
             }
             let where_preds = where_preds.to_string().replace("<br>", &br_with_padding);
@@ -367,8 +371,12 @@ pub(crate) fn print_where_clause<'a, 'tcx: 'a>(
                 if indent == 0 {
                     format!("<br><span class=\"where\">where{where_preds}</span>")
                 } else {
+                    // put the first one on the same line as the 'where' keyword
+                    let where_preds = where_preds.replacen(&br_with_padding, " ", 1);
+
                     let mut clause = br_with_padding;
-                    clause.truncate(clause.len() - 4);
+                    clause.truncate(clause.len() - "where ".len());
+
                     write!(clause, "<span class=\"where\">where{where_preds}</span>")?;
                     clause
                 }
diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs
index 9a7a08ab806..c2d24e51484 100644
--- a/src/librustdoc/html/render/print_item.rs
+++ b/src/librustdoc/html/render/print_item.rs
@@ -645,6 +645,10 @@ fn item_trait(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &clean:
             if count_consts != 0 && count_methods != 0 {
                 w.write_str("\n");
             }
+
+            if !required_methods.is_empty() {
+                write!(w, "    // Required method{}\n", pluralize(required_methods.len()));
+            }
             for (pos, m) in required_methods.iter().enumerate() {
                 render_assoc_item(
                     w,
@@ -663,6 +667,10 @@ fn item_trait(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &clean:
             if !required_methods.is_empty() && !provided_methods.is_empty() {
                 w.write_str("\n");
             }
+
+            if !provided_methods.is_empty() {
+                write!(w, "    // Provided method{}\n", pluralize(provided_methods.len()));
+            }
             for (pos, m) in provided_methods.iter().enumerate() {
                 render_assoc_item(
                     w,
@@ -672,16 +680,8 @@ fn item_trait(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &clean:
                     cx,
                     RenderMode::Normal,
                 );
-                match *m.kind {
-                    clean::MethodItem(ref inner, _)
-                        if !inner.generics.where_predicates.is_empty() =>
-                    {
-                        w.write_str(",\n    { ... }\n");
-                    }
-                    _ => {
-                        w.write_str(" { ... }\n");
-                    }
-                }
+
+                w.write_str(" { ... }\n");
 
                 if pos < provided_methods.len() - 1 {
                     w.write_str("<span class=\"item-spacer\"></span>");
diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css
index a1e91118303..2a9548712f0 100644
--- a/src/librustdoc/html/static/css/rustdoc.css
+++ b/src/librustdoc/html/static/css/rustdoc.css
@@ -1176,6 +1176,7 @@ a.test-arrow:hover {
 .item-spacer {
 	width: 100%;
 	height: 12px;
+	display: block;
 }
 
 .out-of-band > span.since {