rustdoc-search: give longer notification for type corrections
This commit is contained in:
parent
4c11822aeb
commit
b6f81e0434
2 changed files with 10 additions and 5 deletions
|
@ -1996,8 +1996,13 @@ function initSearch(rawSearchIndex) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (results.query.correction !== null) {
|
if (results.query.correction !== null) {
|
||||||
output += "<h3 class=\"search-corrections\">Showing results for " +
|
const orig = results.query.returned.length > 0
|
||||||
`"${results.query.correction}".</h3>`;
|
? results.query.returned[0].name
|
||||||
|
: results.query.elems[0].name;
|
||||||
|
output += "<h3 class=\"search-corrections\">" +
|
||||||
|
`Type "${orig}" not found. ` +
|
||||||
|
"Showing results for " +
|
||||||
|
`"${results.query.correction}" instead.</h3>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
const resultsElem = document.createElement("div");
|
const resultsElem = document.createElement("div");
|
||||||
|
|
|
@ -22,7 +22,7 @@ assert-css: (".search-corrections", {
|
||||||
})
|
})
|
||||||
assert-text: (
|
assert-text: (
|
||||||
".search-corrections",
|
".search-corrections",
|
||||||
"Showing results for \"notablestructwithlongname\"."
|
"Type \"notablestructwithlongnamr\" not found. Showing results for \"notablestructwithlongname\" instead."
|
||||||
)
|
)
|
||||||
|
|
||||||
// Corrections do get shown on the "In Return Type" tab.
|
// Corrections do get shown on the "In Return Type" tab.
|
||||||
|
@ -33,7 +33,7 @@ assert-css: (".search-corrections", {
|
||||||
})
|
})
|
||||||
assert-text: (
|
assert-text: (
|
||||||
".search-corrections",
|
".search-corrections",
|
||||||
"Showing results for \"notablestructwithlongname\"."
|
"Type \"notablestructwithlongnamr\" not found. Showing results for \"notablestructwithlongname\" instead."
|
||||||
)
|
)
|
||||||
|
|
||||||
// Now, explicit return values
|
// Now, explicit return values
|
||||||
|
@ -50,5 +50,5 @@ assert-css: (".search-corrections", {
|
||||||
})
|
})
|
||||||
assert-text: (
|
assert-text: (
|
||||||
".search-corrections",
|
".search-corrections",
|
||||||
"Showing results for \"notablestructwithlongname\"."
|
"Type \"notablestructwithlongnamr\" not found. Showing results for \"notablestructwithlongname\" instead."
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue