Skip to content

Commit 28135b7

Browse files
committed
Remove redundant enableSearchInput function
enableSearchInput was called from two places: - setupSearchLoader - addSearchOptions, which is itself called from setupSearchLoader only This commit can safely get rid of the addSearchOptions calls entirely, and since the setupSearchLoader call is immediately preceded by other method calls on search_input, there's no need to check if it's set.
1 parent 8ccc89b commit 28135b7

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

Diff for: src/librustdoc/html/static/main.js

+2-10
Original file line numberDiff line numberDiff line change
@@ -2208,7 +2208,7 @@ function defocusSearchBar() {
22082208
return "+";
22092209
}
22102210
// button will collapse the section
2211-
// note that this text is also set in the HTML template in render.rs
2211+
// note that this text is also set in the HTML template in ../render/mod.rs
22122212
return "\u2212"; // "\u2212" is "−" minus sign
22132213
}
22142214

@@ -2851,17 +2851,10 @@ function defocusSearchBar() {
28512851
});
28522852
}
28532853

2854-
function enableSearchInput() {
2855-
if (search_input) {
2856-
search_input.removeAttribute('disabled');
2857-
}
2858-
}
2859-
28602854
function addSearchOptions(crates) {
28612855
var elem = document.getElementById("crate-search");
28622856

28632857
if (!elem) {
2864-
enableSearchInput();
28652858
return;
28662859
}
28672860
var savedCrate = getSettingValue("saved-filter-crate");
@@ -2880,7 +2873,6 @@ function defocusSearchBar() {
28802873
elem.value = savedCrate;
28812874
}
28822875
}
2883-
enableSearchInput();
28842876
};
28852877

28862878
function buildHelperPopup() {
@@ -2972,7 +2964,7 @@ function defocusSearchBar() {
29722964
search_input.addEventListener("blur", function() {
29732965
search_input.placeholder = search_input.origPlaceholder;
29742966
});
2975-
enableSearchInput();
2967+
search_input.removeAttribute('disabled');
29762968

29772969
var crateSearchDropDown = document.getElementById("crate-search");
29782970
crateSearchDropDown.addEventListener("focus", loadSearch);

0 commit comments

Comments
 (0)