Skip to content

Commit

Permalink
Auto merge of rust-lang#120579 - GuillaumeGomez:prevent-running-unnee…
Browse files Browse the repository at this point in the history
…ded-code, r=notriddle

Prevent running some code if it is already in the map

I realized that a lot of duplicates were being run through this function. Might be better to prevent them from computing all the information if it's already in the cache.

r? `@notriddle`
  • Loading branch information
bors committed Feb 8, 2024
2 parents 870a01a + 0211221 commit 81bef0b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/librustdoc/clean/inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,14 @@ pub(crate) fn load_attrs<'hir>(cx: &DocContext<'hir>, did: DefId) -> &'hir [ast:
/// These names are used later on by HTML rendering to generate things like
/// source links back to the original item.
pub(crate) fn record_extern_fqn(cx: &mut DocContext<'_>, did: DefId, kind: ItemType) {
if did.is_local() {
if cx.cache.exact_paths.contains_key(&did) {
return;
}
} else if cx.cache.external_paths.contains_key(&did) {
return;
}

let crate_name = cx.tcx.crate_name(did.krate);

let relative =
Expand Down

0 comments on commit 81bef0b

Please sign in to comment.