Skip to content

Commit 7ea4f35

Browse files
committed
less symbols interner locks
1 parent 9ce37dc commit 7ea4f35

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

compiler/rustc_resolve/src/rustdoc.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,13 @@ pub fn unindent_doc_fragments(docs: &mut [DocFragment]) {
167167
///
168168
/// Note: remove the trailing newline where appropriate
169169
pub fn add_doc_fragment(out: &mut String, frag: &DocFragment) {
170-
let s = frag.doc.as_str();
171-
let mut iter = s.lines();
172-
if s.is_empty() {
170+
if frag.doc == kw::Empty {
173171
out.push('\n');
174172
return;
175173
}
174+
let s = frag.doc.as_str();
175+
let mut iter = s.lines();
176+
176177
while let Some(line) = iter.next() {
177178
if line.chars().any(|c| !c.is_whitespace()) {
178179
assert!(line.len() >= frag.indent);

src/librustdoc/html/render/mod.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1698,9 +1698,10 @@ fn render_impl(
16981698
let id = cx.derive_id(format!("{item_type}.{name}"));
16991699
let source_id = trait_
17001700
.and_then(|trait_| {
1701-
trait_.items.iter().find(|item| {
1702-
item.name.map(|n| n.as_str().eq(name.as_str())).unwrap_or(false)
1703-
})
1701+
trait_
1702+
.items
1703+
.iter()
1704+
.find(|item| item.name.map(|n| n == *name).unwrap_or(false))
17041705
})
17051706
.map(|item| format!("{}.{name}", item.type_()));
17061707
write!(w, "<section id=\"{id}\" class=\"{item_type}{in_trait_class}\">");

0 commit comments

Comments
 (0)