Skip to content

Commit 8642c96

Browse files
committed
rustdoc-search: use ES6 Set for deduplication instead of Object
1 parent e34dc7f commit 8642c96

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/librustdoc/html/static/js/search.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,7 @@ function initSearch(rawSearchIndex) {
906906
const results_others = {}, results_in_args = {}, results_returned = {};
907907

908908
function transformResults(results) {
909-
const duplicates = {};
909+
const duplicates = new Set();
910910
const out = [];
911911

912912
for (const result of results) {
@@ -919,10 +919,10 @@ function initSearch(rawSearchIndex) {
919919
// To be sure than it some items aren't considered as duplicate.
920920
obj.fullPath += "|" + obj.ty;
921921

922-
if (duplicates[obj.fullPath]) {
922+
if (duplicates.has(obj.fullPath)) {
923923
continue;
924924
}
925-
duplicates[obj.fullPath] = true;
925+
duplicates.add(obj.fullPath);
926926

927927
obj.href = res[1];
928928
out.push(obj);

0 commit comments

Comments
 (0)