Rollup merge of #38497 - QuietMisdreavus:rustdoc-where-again, r=steveklabnik

rustdoc: properly calculate line length for where clauses

Apparently, while I was cleaning up #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.
This commit is contained in:
Steve Klabnik
2016-12-24 14:29:23 -05:00
committed by GitHub
+1 -1
View File
@@ -207,7 +207,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
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 {