Skip to content

Commit 4477c7c

Browse files
committed
Indent where clause in rustdoc
* Add <span class=‘where’> around clause * CSS rule to format the span (for #20176)
1 parent 070ab63 commit 4477c7c

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/librustdoc/html/format.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ impl<'a> fmt::Show for WhereClause<'a> {
123123
if gens.where_predicates.len() == 0 {
124124
return Ok(());
125125
}
126-
try!(f.write(" where ".as_bytes()));
126+
try!(f.write(" <span class='where'>where ".as_bytes()));
127127
for (i, pred) in gens.where_predicates.iter().enumerate() {
128128
if i > 0 {
129129
try!(f.write(", ".as_bytes()));
@@ -149,6 +149,7 @@ impl<'a> fmt::Show for WhereClause<'a> {
149149
}
150150
}
151151
}
152+
try!(f.write("</span>".as_bytes()));
152153
Ok(())
153154
}
154155
}

src/librustdoc/html/static/main.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,9 @@ nav.sub {
306306
font-size: 1em;
307307
position: relative;
308308
}
309+
/* Shift "where ..." part of method definition down a line and indent it */
310+
.content .method .where { display: block; padding-left: 3.75em; }
311+
309312
.content .methods .docblock { margin-left: 40px; }
310313

311314
.content .impl-items .docblock { margin-left: 40px; }

0 commit comments

Comments
 (0)