Skip to content

Commit ad91915

Browse files
committed
Remove unused code from main.js
It looks like `lev_distance` was used in a very old version of the function, since it was written but never read, and Blame reports that it was added before the `checkGenerics` function header itself. `convertHTMLToPlaintext` is was removed by 768d5e9
1 parent 45b3c28 commit ad91915

File tree

1 file changed

+0
-20
lines changed

1 file changed

+0
-20
lines changed

src/librustdoc/html/static/main.js

-20
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,6 @@ function defocusSearchBar() {
843843
function checkGenerics(obj, val) {
844844
// The names match, but we need to be sure that all generics kinda
845845
// match as well.
846-
var lev_distance = MAX_LEV_DISTANCE + 1;
847846
if (val.generics.length > 0) {
848847
if (obj.length > GENERICS_DATA &&
849848
obj[GENERICS_DATA].length >= val.generics.length) {
@@ -866,7 +865,6 @@ function defocusSearchBar() {
866865
}
867866
if (lev.pos !== -1) {
868867
elems.splice(lev.pos, 1);
869-
lev_distance = Math.min(lev.lev, lev_distance);
870868
total += lev.lev;
871869
done += 1;
872870
} else {
@@ -2054,24 +2052,6 @@ function defocusSearchBar() {
20542052
}
20552053
}
20562054

2057-
/**
2058-
* Convert HTML to plaintext:
2059-
*
2060-
* * Replace "<code>foo</code>" with "`foo`"
2061-
* * Strip all other HTML tags
2062-
*
2063-
* Used by the dynamic sidebar crate list renderer.
2064-
*
2065-
* @param {[string]} html [The HTML to convert]
2066-
* @return {[string]} [The resulting plaintext]
2067-
*/
2068-
function convertHTMLToPlaintext(html) {
2069-
var x = document.createElement("div");
2070-
x.innerHTML = html.replace('<code>', '`').replace('</code>', '`');
2071-
return x.innerText;
2072-
}
2073-
2074-
20752055
// delayed sidebar rendering.
20762056
window.initSidebarItems = function(items) {
20772057
var sidebar = document.getElementsByClassName("sidebar-elems")[0];

0 commit comments

Comments
 (0)