From 7ea4f3576675617c68e70014c955a49127c78fe0 Mon Sep 17 00:00:00 2001 From: klensy Date: Fri, 15 Mar 2024 10:54:40 +0300 Subject: [PATCH] less symbols interner locks --- compiler/rustc_resolve/src/rustdoc.rs | 7 ++++--- src/librustdoc/html/render/mod.rs | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/compiler/rustc_resolve/src/rustdoc.rs b/compiler/rustc_resolve/src/rustdoc.rs index 4ff4ccf5e98..0ebcad3cdb8 100644 --- a/compiler/rustc_resolve/src/rustdoc.rs +++ b/compiler/rustc_resolve/src/rustdoc.rs @@ -167,12 +167,13 @@ pub fn unindent_doc_fragments(docs: &mut [DocFragment]) { /// /// Note: remove the trailing newline where appropriate pub fn add_doc_fragment(out: &mut String, frag: &DocFragment) { - let s = frag.doc.as_str(); - let mut iter = s.lines(); - if s.is_empty() { + if frag.doc == kw::Empty { out.push('\n'); return; } + let s = frag.doc.as_str(); + let mut iter = s.lines(); + while let Some(line) = iter.next() { if line.chars().any(|c| !c.is_whitespace()) { assert!(line.len() >= frag.indent); diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index fe83095f944..bfd67ccbd3f 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -1698,9 +1698,10 @@ fn doc_impl_item( let id = cx.derive_id(format!("{item_type}.{name}")); let source_id = trait_ .and_then(|trait_| { - trait_.items.iter().find(|item| { - item.name.map(|n| n.as_str().eq(name.as_str())).unwrap_or(false) - }) + trait_ + .items + .iter() + .find(|item| item.name.map(|n| n == *name).unwrap_or(false)) }) .map(|item| format!("{}.{name}", item.type_())); write!(w, "
");