diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index d6c89ef6ff0..55ebfcc3707 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -371,6 +371,11 @@ return false; } + function checkReturned(obj, val) { + return obj && obj.type && obj.type.output && + obj.type.output.name.toLowerCase() === val; + } + function typePassesFilter(filter, type) { // No filter if (filter < 0) return true; @@ -503,6 +508,15 @@ lev: lev_distance, }); } + } else if (checkReturned(searchIndex[j], val)) { + if (typePassesFilter(typeFilter, searchIndex[j].ty)) { + results.push({ + id: j, + index: 0, + // we want lev results to go lower than others + lev: lev_distance, + }); + } } if (results.length === max) { break;