We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents ca99d51 + d505c5a commit 76c47fbCopy full SHA for 76c47fb
src/librustdoc/html/static/js/search.js
@@ -142,13 +142,11 @@ function initSearch(rawSearchIndex) {
142
}
143
144
function itemTypeFromName(typename) {
145
- for (let i = 0, len = itemTypes.length; i < len; ++i) {
146
- if (itemTypes[i] === typename) {
147
- return i;
148
- }
+ const index = itemTypes.findIndex(i => i === typename);
+ if (index < 0) {
+ throw new Error("Unknown type filter `" + typename + "`");
149
150
-
151
- throw new Error("Unknown type filter `" + typename + "`");
+ return index;
152
153
154
/**
0 commit comments