Skip to content

Commit 6459121

Browse files
authored
Rollup merge of #118856 - notriddle:notriddle/search-js, r=GuillaumeGomez
rustdoc-search: clean up parser The `c === "="` was redundant when `isSeparatorCharacter` already checks that. The function `isStopCharacter` and `isEndCharacter` functions did exactly the same thing and have synonymous names. There doesn't seem much point in having both.
2 parents cd7809b + 4f80833 commit 6459121

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

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

+2-7
Original file line numberDiff line numberDiff line change
@@ -298,10 +298,6 @@ function initSearch(rawSearchIndex) {
298298
return "=,>-]".indexOf(c) !== -1;
299299
}
300300

301-
function isStopCharacter(c) {
302-
return isEndCharacter(c);
303-
}
304-
305301
function isErrorCharacter(c) {
306302
return "()".indexOf(c) !== -1;
307303
}
@@ -617,8 +613,7 @@ function initSearch(rawSearchIndex) {
617613
}
618614
} else if (
619615
c === "[" ||
620-
c === "=" ||
621-
isStopCharacter(c) ||
616+
isEndCharacter(c) ||
622617
isSpecialStartCharacter(c) ||
623618
isSeparatorCharacter(c)
624619
) {
@@ -917,7 +912,7 @@ function initSearch(rawSearchIndex) {
917912

918913
while (parserState.pos < parserState.length) {
919914
const c = parserState.userQuery[parserState.pos];
920-
if (isStopCharacter(c)) {
915+
if (isEndCharacter(c)) {
921916
foundStopChar = true;
922917
if (isSeparatorCharacter(c)) {
923918
parserState.pos += 1;

0 commit comments

Comments
 (0)