Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustdoc: reduce allocs in FnDecl::inner_full_print #109011

Merged
merged 1 commit into from
Mar 13, 2023

Commits on Mar 11, 2023

  1. 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.
    jsha committed Mar 11, 2023
    Configuration menu
    Copy the full SHA
    121ae1d View commit details
    Browse the repository at this point in the history