about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser/expr.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-03-13 02:17:49 +0000
committerbors <bors@rust-lang.org>2023-03-13 02:17:49 +0000
commitd610b0c514b9ccb0dad5d0b77ce4c518f71b92c8 (patch)
treea86c351e36c71d611f424261e31439a048648f6a /compiler/rustc_parse/src/parser/expr.rs
parentb05bb2900825e4d063ebf3f0f11afb08baed3bc6 (diff)
parent121ae1d29cd22e3438732077b6fc3d3587f30ec3 (diff)
downloadrust-d610b0c514b9ccb0dad5d0b77ce4c518f71b92c8.tar.gz
rust-d610b0c514b9ccb0dad5d0b77ce4c518f71b92c8.zip
Auto merge of #109011 - jsha:reduce-allocations-inner-full-print, r=notriddle
rustdoc: reduce allocs in FnDecl::inner_full_print

Instead of maintaining parallel buffers for both HTML and non-HTML output, follow the idiom from the rest of format.rs that f.alternate() == true means textual output. Also, add an argument to control line wrapping explicitly.

This allows the caller to render once with textual output and no line wrapping, to decide whether line wrapping should be applied in the final HTML output.

Also, remove some format! and " ".repeat calls, and remove a dependency on calling `String::replace` to switch from newlines to spaces.

This coincidentally fixes some minor bugs where the old code was undercounting the number of characters for a declaration in text mode.
Diffstat (limited to 'compiler/rustc_parse/src/parser/expr.rs')
0 files changed, 0 insertions, 0 deletions