Skip to content

Commit 10b6097

Browse files
authored
Rollup merge of rust-lang#38497 - QuietMisdreavus:rustdoc-where-again, 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.
2 parents 80d745a + 941b6b0 commit 10b6097

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/librustdoc/html/format.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ impl<'a> fmt::Display for WhereClause<'a> {
207207
if !f.alternate() {
208208
clause.push_str("</span>");
209209
let plain = format!("{:#}", self);
210-
if plain.len() > 80 {
210+
if plain.len() + pad > 80 {
211211
//break it onto its own line regardless, but make sure method impls and trait
212212
//blocks keep their fixed padding (2 and 9, respectively)
213213
let padding = if pad > 10 {

0 commit comments

Comments
 (0)