Auto merge of #80295 - GuillaumeGomez:beautify-rework, r=petrochenkov

Rework beautify_doc_string so that it returns a Symbol instead of a String

This commit comes from https://github.com/rust-lang/rust/pull/80261, the goal here is to inspect the impact on performance of this change on its own.

The idea of rewriting `beautify_doc_string` is to not go through `String` if we don't need to update the doc comment to be able to keep the original `Symbol` and also to have better performance.

r? `@jyn514`
This commit is contained in:
bors 2020-12-24 11:30:24 +00:00
commit 2acf6ee6d2
4 changed files with 39 additions and 37 deletions

View file

@ -621,7 +621,7 @@ impl Attributes {
let clean_attr = |(attr, parent_module): (&ast::Attribute, _)| {
if let Some(value) = attr.doc_str() {
trace!("got doc_str={:?}", value);
let value = beautify_doc_string(value);
let value = beautify_doc_string(value).to_string();
let kind = if attr.is_doc_comment() {
DocFragmentKind::SugaredDoc
} else {