Skip to content

Commit fe597dc

Browse files
committed
Auto merge of #39222 - GuillaumeGomez:rustdoc_where, r=frewsxcv,steveklabnik,alexcrichton,nrc
Force backline on all where in docs Pictures are better than words in this case: Before: <img width="1440" alt="screen shot 2017-01-21 at 15 34 27" src="https://cloud.githubusercontent.com/assets/3050060/22175139/6e7c75d8-dfef-11e6-9904-023d63e609d2.png"> After: <img width="1440" alt="screen shot 2017-01-21 at 15 34 32" src="https://cloud.githubusercontent.com/assets/3050060/22175140/75cc3846-dfef-11e6-9799-fffb213653e4.png"> r? @steveklabnik cc @rust-lang/docs
2 parents d2d8ae6 + cbfc8fe commit fe597dc

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/librustdoc/html/format.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ impl<'a> fmt::Display for WhereClause<'a> {
165165
if f.alternate() {
166166
clause.push_str(" where ");
167167
} else {
168-
clause.push_str(" <span class='where'>where ");
168+
clause.push_str(" <span class='where fmt-newline'>where ");
169169
}
170170
for (i, pred) in gens.where_predicates.iter().enumerate() {
171171
if i > 0 {
@@ -208,10 +208,9 @@ impl<'a> fmt::Display for WhereClause<'a> {
208208
clause.push_str("</span>");
209209
let plain = format!("{:#}", self);
210210
if plain.len() + pad > 80 {
211-
//break it onto its own line regardless, but make sure method impls and trait
212-
//blocks keep their fixed padding (2 and 9, respectively)
211+
// break it onto its own line regardless, but make sure method impls and trait
212+
// blocks keep their fixed padding (2 and 9, respectively)
213213
let padding = if pad > 10 {
214-
clause = clause.replace("class='where'", "class='where fmt-newline'");
215214
repeat("&nbsp;").take(8).collect::<String>()
216215
} else {
217216
repeat("&nbsp;").take(pad + 6).collect::<String>()

0 commit comments

Comments
 (0)