Skip to content

Commit

Permalink
rustdoc: improve comments based on feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
notriddle committed Apr 9, 2024
1 parent f36c5af commit 7e7a87c
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/librustdoc/html/render/search_index.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<<<<<<< HEAD
pub(crate) mod encode;

use std::collections::hash_map::Entry;
Expand Down Expand Up @@ -170,10 +171,12 @@ pub(crate) fn build_index<'tcx>(
let exact_fqp = exact_paths
.get(&defid)
.or_else(|| external_paths.get(&defid).map(|&(ref fqp, _)| fqp))
// re-exports only count if the name is exactly the same
// this is a size optimization, as well as a DWIM attempt
// since if the names are not the same, the intent probably
// isn't, either
// Re-exports only count if the name is exactly the same.
// This is a size optimization, since it means we only need
// to store the name once (and the path is re-used for everything
// exported from this same module). It's also likely to Do
// What I Mean, since if a re-export changes the name, it might
// also be a change in semantic meaning.
.filter(|fqp| fqp.last() == fqp.last());
Some(insert_into_map(
itemid_to_pathid,
Expand Down Expand Up @@ -356,10 +359,12 @@ pub(crate) fn build_index<'tcx>(
.get(&defid)
.or_else(|| external_paths.get(&defid).map(|&(ref fqp, _)| fqp));
item.exact_path = exact_fqp.and_then(|fqp| {
// re-exports only count if the name is exactly the same
// this is a size optimization, as well as a DWIM attempt
// since if the names are not the same, the intent probably
// isn't, either
// Re-exports only count if the name is exactly the same.
// This is a size optimization, since it means we only need
// to store the name once (and the path is re-used for everything
// exported from this same module). It's also likely to Do
// What I Mean, since if a re-export changes the name, it might
// also be a change in semantic meaning.
if fqp.last() != Some(&item.name) {
return None;
}
Expand Down

0 comments on commit 7e7a87c

Please sign in to comment.