-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rustdoc-search: use ES6 Map
and Set
where they make sense
#110305
Conversation
r? @jsha (rustbot has picked a reviewer for you, use r? to override) |
Some changes occurred in HTML/CSS/JS. cc @GuillaumeGomez, @Folyd, @jsha |
3124256
to
53f499d
Compare
let match = null; | ||
if (elems[generic.name]) { | ||
match = generic.name; | ||
} else { | ||
for (const elem_name in elems) { | ||
if (!hasOwnPropertyRustdoc(elems, elem_name)) { | ||
continue; | ||
} | ||
if (elem_name === generic) { | ||
match = elem_name; | ||
break; | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This version of the code was a bit messed up.
The original version of this code from d7971e5 was built to search the generics list for the lowest Levenshtein edit distance.
It was changed in be41750 to not check levenshtein distance any more, but this code remained, vestigial since it's comparing an object with a string and therefore can never find a match.
Nice improvement, thanks! @bors r+ rollup |
Rollup of 7 pull requests Successful merges: - rust-lang#103682 (Stabilize rustdoc `--test-run-directory`) - rust-lang#106249 (Create "suggested tests" tool in `rustbuild`) - rust-lang#110047 (Add link to `collections` docs to `extend` trait) - rust-lang#110269 (Add `tidy-alphabetical` to features in `core`) - rust-lang#110292 (Add `tidy-alphabetical` to features in `alloc` & `std`) - rust-lang#110305 (rustdoc-search: use ES6 `Map` and `Set` where they make sense) - rust-lang#110315 (Add a stable MIR way to get the main function) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Since all supported browsers now support these classes, and rustdoc has started using them in some places, it might as well use them everywhere it makes sense (because, as MDN's Map page says, it "performs better in scenarios involving frequent additions and removals of key-value pairs.").