Skip to content

Commit

Permalink
Rollup merge of #87037 - notriddle:notriddle/search-cleanup-getobject…
Browse files Browse the repository at this point in the history
…namefromid, r=GuillaumeGomez

cleanup(rustdoc): remove unused function getObjectNameById

This function was used in an earlier version, when idx's were used to serialize function inputs and outputs. That's not done any more, so removed the JS-side support for it.
  • Loading branch information
JohnTitor authored Jul 11, 2021
2 parents a2eebfb + f6e3644 commit 1232df9
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions src/librustdoc/html/static/js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,13 +289,6 @@ window.initSearch = function(rawSearchIndex) {
};
}

function getObjectNameFromId(id) {
if (typeof id === "number") {
return searchIndex[id].name;
}
return id;
}

function checkGenerics(obj, val) {
// The names match, but we need to be sure that all generics kinda
// match as well.
Expand All @@ -306,10 +299,10 @@ window.initSearch = function(rawSearchIndex) {
var elems = Object.create(null);
var elength = obj[GENERICS_DATA].length;
for (var x = 0; x < elength; ++x) {
if (!elems[getObjectNameFromId(obj[GENERICS_DATA][x])]) {
elems[getObjectNameFromId(obj[GENERICS_DATA][x])] = 0;
if (!elems[obj[GENERICS_DATA][x]]) {
elems[obj[GENERICS_DATA][x]] = 0;
}
elems[getObjectNameFromId(obj[GENERICS_DATA][x])] += 1;
elems[obj[GENERICS_DATA][x]] += 1;
}
var total = 0;
var done = 0;
Expand All @@ -318,7 +311,7 @@ window.initSearch = function(rawSearchIndex) {
var vlength = val.generics.length;
for (x = 0; x < vlength; ++x) {
var lev = MAX_LEV_DISTANCE + 1;
var firstGeneric = getObjectNameFromId(val.generics[x]);
var firstGeneric = val.generics[x];
var match = null;
if (elems[firstGeneric]) {
match = firstGeneric;
Expand Down Expand Up @@ -361,16 +354,16 @@ window.initSearch = function(rawSearchIndex) {
var elems = Object.create(null);
len = obj[GENERICS_DATA].length;
for (x = 0; x < len; ++x) {
if (!elems[getObjectNameFromId(obj[GENERICS_DATA][x])]) {
elems[getObjectNameFromId(obj[GENERICS_DATA][x])] = 0;
if (!elems[obj[GENERICS_DATA][x]]) {
elems[obj[GENERICS_DATA][x]] = 0;
}
elems[getObjectNameFromId(obj[GENERICS_DATA][x])] += 1;
elems[obj[GENERICS_DATA][x]] += 1;
}

var allFound = true;
len = val.generics.length;
for (x = 0; x < len; ++x) {
firstGeneric = getObjectNameFromId(val.generics[x]);
firstGeneric = val.generics[x];
if (elems[firstGeneric]) {
elems[firstGeneric] -= 1;
} else {
Expand Down

0 comments on commit 1232df9

Please sign in to comment.