about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-12-12 17:40:55 +0100
committerGitHub <noreply@github.com>2023-12-12 17:40:55 +0100
commit6459121a6c264c0dafe2c131cc9920201cf792c3 (patch)
tree38074ae4c9d8094a76edec03e97a266e2c6a5193
parentcd7809b953d1ae8c9421a408639b4d864011977b (diff)
parent4f8083374d99c50868716b53c9925962527b1384 (diff)
downloadrust-6459121a6c264c0dafe2c131cc9920201cf792c3.tar.gz
rust-6459121a6c264c0dafe2c131cc9920201cf792c3.zip
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.
-rw-r--r--src/librustdoc/html/static/js/search.js9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/librustdoc/html/static/js/search.js b/src/librustdoc/html/static/js/search.js
index a521bf66bed..f2875b7f01e 100644
--- a/src/librustdoc/html/static/js/search.js
+++ b/src/librustdoc/html/static/js/search.js
@@ -298,10 +298,6 @@ function initSearch(rawSearchIndex) {
         return "=,>-]".indexOf(c) !== -1;
     }
 
-    function isStopCharacter(c) {
-        return isEndCharacter(c);
-    }
-
     function isErrorCharacter(c) {
         return "()".indexOf(c) !== -1;
     }
@@ -617,8 +613,7 @@ function initSearch(rawSearchIndex) {
                     }
                 } else if (
                     c === "[" ||
-                    c === "=" ||
-                    isStopCharacter(c) ||
+                    isEndCharacter(c) ||
                     isSpecialStartCharacter(c) ||
                     isSeparatorCharacter(c)
                 ) {
@@ -917,7 +912,7 @@ function initSearch(rawSearchIndex) {
 
         while (parserState.pos < parserState.length) {
             const c = parserState.userQuery[parserState.pos];
-            if (isStopCharacter(c)) {
+            if (isEndCharacter(c)) {
                 foundStopChar = true;
                 if (isSeparatorCharacter(c)) {
                     parserState.pos += 1;