Skip to content
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

Merged
merged 4 commits into from
Apr 14, 2023

Conversation

notriddle
Copy link
Contributor

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.").

@rustbot
Copy link
Collaborator

rustbot commented Apr 14, 2023

r? @jsha

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Apr 14, 2023
@rustbot
Copy link
Collaborator

rustbot commented Apr 14, 2023

Some changes occurred in HTML/CSS/JS.

cc @GuillaumeGomez, @Folyd, @jsha

Comment on lines -1117 to -1130
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;
}
}
}
Copy link
Contributor Author

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.

@GuillaumeGomez
Copy link
Member

Nice improvement, thanks!

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Apr 14, 2023

📌 Commit 53f499d has been approved by GuillaumeGomez

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 14, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 14, 2023
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
@bors bors merged commit 35a3493 into rust-lang:master Apr 14, 2023
@rustbot rustbot added this to the 1.70.0 milestone Apr 14, 2023
@notriddle notriddle deleted the notriddle/es6-map-set branch April 14, 2023 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants