Skip to content

Commit d611301

Browse files
Small generics search improvement
1 parent 64382f4 commit d611301

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/librustdoc/html/static/main.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,10 @@ if (!DOMTokenList.prototype.remove) {
714714
}
715715
lev_distance = Math.min(levenshtein(obj[NAME], val.name), lev_distance);
716716
if (lev_distance <= MAX_LEV_DISTANCE) {
717-
lev_distance = Math.min(checkGenerics(obj, val), lev_distance);
717+
// The generics didn't match but the name kinda did so we give it
718+
// a levenshtein distance value that isn't *this* good so it goes
719+
// into the search results but not too high.
720+
lev_distance = Math.ceil((checkGenerics(obj, val) + lev_distance) / 2);
718721
} else if (obj.length > GENERICS_DATA && obj[GENERICS_DATA].length > 0) {
719722
// We can check if the type we're looking for is inside the generics!
720723
var olength = obj[GENERICS_DATA].length;

0 commit comments

Comments
 (0)