Skip to content

Commit 395840c

Browse files
committed
rustdoc-search: use more descriptive "x not found; y instead" message
1 parent 7529d87 commit 395840c

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -2000,7 +2000,7 @@ function initSearch(rawSearchIndex) {
20002000
: results.query.elems[0].name;
20012001
output += "<h3 class=\"search-corrections\">" +
20022002
`Type "${orig}" not found. ` +
2003-
"Showing results for " +
2003+
"Showing results for closest type name " +
20042004
`"${results.query.correction}" instead.</h3>`;
20052005
}
20062006

tests/rustdoc-gui/search-corrections.goml

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// ignore-tidy-linelength
2+
13
// Checks that the search tab result tell the user about corrections
24
// First, try a search-by-name
35
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
@@ -22,7 +24,7 @@ assert-css: (".search-corrections", {
2224
})
2325
assert-text: (
2426
".search-corrections",
25-
"Type \"notablestructwithlongnamr\" not found. Showing results for \"notablestructwithlongname\" instead."
27+
"Type \"notablestructwithlongnamr\" not found. Showing results for closest type name \"notablestructwithlongname\" instead."
2628
)
2729

2830
// Corrections do get shown on the "In Return Type" tab.
@@ -33,7 +35,7 @@ assert-css: (".search-corrections", {
3335
})
3436
assert-text: (
3537
".search-corrections",
36-
"Type \"notablestructwithlongnamr\" not found. Showing results for \"notablestructwithlongname\" instead."
38+
"Type \"notablestructwithlongnamr\" not found. Showing results for closest type name \"notablestructwithlongname\" instead."
3739
)
3840

3941
// Now, explicit return values
@@ -50,5 +52,5 @@ assert-css: (".search-corrections", {
5052
})
5153
assert-text: (
5254
".search-corrections",
53-
"Type \"notablestructwithlongnamr\" not found. Showing results for \"notablestructwithlongname\" instead."
55+
"Type \"notablestructwithlongnamr\" not found. Showing results for closest type name \"notablestructwithlongname\" instead."
5456
)

0 commit comments

Comments
 (0)