Skip to content

Commit a71b3f8

Browse files
committed
refactor callback into named function
1 parent e1a4d1d commit a71b3f8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

+5-3
Original file line numberDiff line numberDiff line change
@@ -1945,13 +1945,15 @@ class DocSearch {
19451945
return query;
19461946
}
19471947

1948-
const nonCrateElems = query.elems.filter(function (elem) {
1949-
if (elem.typeFilter === TY_CRATE) {
1948+
function handleCrateFilters(elem) {
1949+
if (elem.typeFilter === TY_CRATE) {
19501950
query.filterCrates = elem.name;
19511951
return false;
19521952
}
19531953
return true;
1954-
});
1954+
1955+
}
1956+
const nonCrateElems = query.elems.filter(handleCrateFilters);
19551957
if (nonCrateElems.length !== query.elems.length) {
19561958
query.elems = nonCrateElems;
19571959
query.userQuery = query.elems.join(", ");

0 commit comments

Comments
 (0)