Skip to content

Commit 7e7a87c

Browse files
committed
rustdoc: improve comments based on feedback
1 parent f36c5af commit 7e7a87c

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

src/librustdoc/html/render/search_index.rs

+13-8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<<<<<<< HEAD
12
pub(crate) mod encode;
23

34
use std::collections::hash_map::Entry;
@@ -170,10 +171,12 @@ pub(crate) fn build_index<'tcx>(
170171
let exact_fqp = exact_paths
171172
.get(&defid)
172173
.or_else(|| external_paths.get(&defid).map(|&(ref fqp, _)| fqp))
173-
// re-exports only count if the name is exactly the same
174-
// this is a size optimization, as well as a DWIM attempt
175-
// since if the names are not the same, the intent probably
176-
// isn't, either
174+
// Re-exports only count if the name is exactly the same.
175+
// This is a size optimization, since it means we only need
176+
// to store the name once (and the path is re-used for everything
177+
// exported from this same module). It's also likely to Do
178+
// What I Mean, since if a re-export changes the name, it might
179+
// also be a change in semantic meaning.
177180
.filter(|fqp| fqp.last() == fqp.last());
178181
Some(insert_into_map(
179182
itemid_to_pathid,
@@ -356,10 +359,12 @@ pub(crate) fn build_index<'tcx>(
356359
.get(&defid)
357360
.or_else(|| external_paths.get(&defid).map(|&(ref fqp, _)| fqp));
358361
item.exact_path = exact_fqp.and_then(|fqp| {
359-
// re-exports only count if the name is exactly the same
360-
// this is a size optimization, as well as a DWIM attempt
361-
// since if the names are not the same, the intent probably
362-
// isn't, either
362+
// Re-exports only count if the name is exactly the same.
363+
// This is a size optimization, since it means we only need
364+
// to store the name once (and the path is re-used for everything
365+
// exported from this same module). It's also likely to Do
366+
// What I Mean, since if a re-export changes the name, it might
367+
// also be a change in semantic meaning.
363368
if fqp.last() != Some(&item.name) {
364369
return None;
365370
}

0 commit comments

Comments
 (0)