diff options
| author | Guillaume Gomez <guillaume.gomez@huawei.com> | 2022-07-02 12:43:07 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume.gomez@huawei.com> | 2022-07-02 12:43:07 +0200 |
| commit | b17cf7a493bd9e80607ba0eeafcc2c22730f056c (patch) | |
| tree | 574a30c5e114e7324fcee3c675c64065b5cb0bb6 | |
| parent | 66c83ffca1512ed76f9445ec7f7280f768ef71c4 (diff) | |
| download | rust-b17cf7a493bd9e80607ba0eeafcc2c22730f056c.tar.gz rust-b17cf7a493bd9e80607ba0eeafcc2c22730f056c.zip | |
Remove unwanted trailing whitespaces for long declarations
| -rw-r--r-- | src/librustdoc/html/format.rs | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index 056eda089c1..5584ecd287a 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -1283,10 +1283,6 @@ impl clean::FnDecl { let mut args = Buffer::html(); let mut args_plain = Buffer::new(); for (i, input) in self.inputs.values.iter().enumerate() { - if i == 0 { - args.push_str("<br>"); - } - if let Some(selfty) = input.to_self() { match selfty { clean::SelfValue => { @@ -1312,8 +1308,7 @@ impl clean::FnDecl { } } else { if i > 0 { - args.push_str(" <br>"); - args_plain.push_str(" "); + args.push_str("<br>"); } if input.is_const { args.push_str("const "); @@ -1360,13 +1355,14 @@ impl clean::FnDecl { let full_pad = format!("<br>{}", " ".repeat(indent + 4)); let close_pad = format!("<br>{}", " ".repeat(indent)); format!( - "({args}{close}){arrow}", + "({pad}{args}{close}){arrow}", + pad = if self.inputs.values.is_empty() { "" } else { &full_pad }, args = args.replace("<br>", &full_pad), close = close_pad, arrow = arrow ) } else { - format!("({args}){arrow}", args = args.replace("<br>", ""), arrow = arrow) + format!("({args}){arrow}", args = args.replace("<br>", " "), arrow = arrow) }; if f.alternate() { |
