diff options
| author | Michael Howell <michael@notriddle.com> | 2024-01-13 16:43:59 -0700 |
|---|---|---|
| committer | Michael Howell <michael@notriddle.com> | 2024-04-08 17:07:20 -0700 |
| commit | 7e7a87c66788a9021d9d7cc5fdd8a203d6719942 (patch) | |
| tree | dbd179f3fceff3746f5e40a2e2118c0ca6367087 /src/librustdoc/html | |
| parent | f36c5af359319741f24a94c55bba021f6146efec (diff) | |
| download | rust-7e7a87c66788a9021d9d7cc5fdd8a203d6719942.tar.gz rust-7e7a87c66788a9021d9d7cc5fdd8a203d6719942.zip | |
rustdoc: improve comments based on feedback
Diffstat (limited to 'src/librustdoc/html')
| -rw-r--r-- | src/librustdoc/html/render/search_index.rs | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/librustdoc/html/render/search_index.rs b/src/librustdoc/html/render/search_index.rs index aad943d872f..917be7cc8e9 100644 --- a/src/librustdoc/html/render/search_index.rs +++ b/src/librustdoc/html/render/search_index.rs @@ -1,3 +1,4 @@ +<<<<<<< HEAD pub(crate) mod encode; use std::collections::hash_map::Entry; @@ -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, @@ -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; } |
