From 93f17117ed50a972bfabea86762241cd9ac5ccbd Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Wed, 29 Nov 2023 10:23:42 -0700 Subject: [PATCH] rustdoc-search: removed dead parser code This is already covered by the normal unexpected char path. --- src/librustdoc/html/static/js/search.js | 2 -- tests/rustdoc-js-std/parser-errors.js | 9 +++++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/librustdoc/html/static/js/search.js b/src/librustdoc/html/static/js/search.js index dc6cdcd569aa..37e5276a4949 100644 --- a/src/librustdoc/html/static/js/search.js +++ b/src/librustdoc/html/static/js/search.js @@ -473,8 +473,6 @@ function initSearch(rawSearchIndex) { const path = name.trim(); if (path.length === 0 && generics.length === 0) { throw ["Unexpected ", parserState.userQuery[parserState.pos]]; - } else if (path === "*") { - throw ["Unexpected ", "*"]; } if (query.literalSearch && parserState.totalElems - parserState.genericsElems > 0) { throw ["Cannot have more than one element if you use quotes"]; diff --git a/tests/rustdoc-js-std/parser-errors.js b/tests/rustdoc-js-std/parser-errors.js index 410fe11b9cf0..cb1654c0fb0b 100644 --- a/tests/rustdoc-js-std/parser-errors.js +++ b/tests/rustdoc-js-std/parser-errors.js @@ -17,6 +17,15 @@ const PARSED = [ userQuery: "->

", error: "Found generics without a path", }, + { + query: '-> *', + elems: [], + foundElems: 0, + original: "-> *", + returned: [], + userQuery: "-> *", + error: "Unexpected `*`", + }, { query: 'a<"P">', elems: [],