about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Howell <michael@notriddle.com>2023-04-20 14:32:02 -0700
committerMichael Howell <michael@notriddle.com>2023-04-20 14:32:02 -0700
commit395840cd5e0d349ff33a2b0adb01d13848de4d0f (patch)
tree873bff4643a94e3b97b4fcad0d301bccdcef0c4e
parent7529d874075df61209d3aa61b7072ba1714f4a17 (diff)
downloadrust-395840cd5e0d349ff33a2b0adb01d13848de4d0f.tar.gz
rust-395840cd5e0d349ff33a2b0adb01d13848de4d0f.zip
rustdoc-search: use more descriptive "x not found; y instead" message
-rw-r--r--src/librustdoc/html/static/js/search.js2
-rw-r--r--tests/rustdoc-gui/search-corrections.goml8
2 files changed, 6 insertions, 4 deletions
diff --git a/src/librustdoc/html/static/js/search.js b/src/librustdoc/html/static/js/search.js
index 71568cd700c..92e5f408936 100644
--- a/src/librustdoc/html/static/js/search.js
+++ b/src/librustdoc/html/static/js/search.js
@@ -2000,7 +2000,7 @@ function initSearch(rawSearchIndex) {
                 : results.query.elems[0].name;
             output += "<h3 class=\"search-corrections\">" +
                 `Type "${orig}" not found. ` +
-                "Showing results for " +
+                "Showing results for closest type name " +
                 `"${results.query.correction}" instead.</h3>`;
         }
 
diff --git a/tests/rustdoc-gui/search-corrections.goml b/tests/rustdoc-gui/search-corrections.goml
index 323dd658426..5d1b83b35c5 100644
--- a/tests/rustdoc-gui/search-corrections.goml
+++ b/tests/rustdoc-gui/search-corrections.goml
@@ -1,3 +1,5 @@
+// ignore-tidy-linelength
+
 // Checks that the search tab result tell the user about corrections
 // First, try a search-by-name
 go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
@@ -22,7 +24,7 @@ assert-css: (".search-corrections", {
 })
 assert-text: (
     ".search-corrections",
-    "Type \"notablestructwithlongnamr\" not found. Showing results for \"notablestructwithlongname\" instead."
+    "Type \"notablestructwithlongnamr\" not found. Showing results for closest type name \"notablestructwithlongname\" instead."
 )
 
 // Corrections do get shown on the "In Return Type" tab.
@@ -33,7 +35,7 @@ assert-css: (".search-corrections", {
 })
 assert-text: (
     ".search-corrections",
-    "Type \"notablestructwithlongnamr\" not found. Showing results for \"notablestructwithlongname\" instead."
+    "Type \"notablestructwithlongnamr\" not found. Showing results for closest type name \"notablestructwithlongname\" instead."
 )
 
 // Now, explicit return values
@@ -50,5 +52,5 @@ assert-css: (".search-corrections", {
 })
 assert-text: (
     ".search-corrections",
-    "Type \"notablestructwithlongnamr\" not found. Showing results for \"notablestructwithlongname\" instead."
+    "Type \"notablestructwithlongnamr\" not found. Showing results for closest type name \"notablestructwithlongname\" instead."
 )