Skip to content

Commit

Permalink
Rollup merge of rust-lang#38497 - QuietMisdreavus:rustdoc-where-again…
Browse files Browse the repository at this point in the history
…, r=steveklabnik

rustdoc: properly calculate line length for where clauses

Apparently, while I was cleaning up rust-lang#37190, I regressed the formatting for long where clauses, where it wouldn't take the "prefix" length into account when deciding whether to break the line up. This patch fixes that.
  • Loading branch information
steveklabnik authored Dec 24, 2016
2 parents 80d745a + 941b6b0 commit 10b6097
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/librustdoc/html/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ impl<'a> fmt::Display for WhereClause<'a> {
if !f.alternate() {
clause.push_str("</span>");
let plain = format!("{:#}", self);
if plain.len() > 80 {
if plain.len() + pad > 80 {
//break it onto its own line regardless, but make sure method impls and trait
//blocks keep their fixed padding (2 and 9, respectively)
let padding = if pad > 10 {
Expand Down

0 comments on commit 10b6097

Please sign in to comment.