Skip to content

Commit

Permalink
rustdoc-search: disambiguate generics
Browse files Browse the repository at this point in the history
This cleans up the Simd page. It should be sufficient, even though
it can wind up showing more than necessary, but allows each item
to be considered in isolation.
  • Loading branch information
notriddle committed Oct 25, 2023
1 parent 8206a6c commit a463f43
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/librustdoc/html/static/js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -1268,7 +1268,10 @@ function initSearch(rawSearchIndex) {
}
} else {
push(fnType.name, fnType.highlighted);
if (fnType.generics && fnType.generics.some(isTransitivelyHighlighted)) {
if (fnType.generics && fnType.generics.length > 0 &&
(fnType.generics.some(isTransitivelyHighlighted)
|| row.implDisambiguator !== null)
) {
pushNotHighlighted("<");
formatTypeList(fnType.generics, ", ");
pushNotHighlighted(">");
Expand Down
6 changes: 4 additions & 2 deletions tests/rustdoc-js/search-method-disambiguate.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ const EXPECTED = [
{
'path': 'search_method_disambiguate::MyTy',
'name': 'my_method',
'href': '../search_method_disambiguate/struct.MyTy.html#impl-X-for-MyTy%3Cbool%3E/method.my_method'
'href': '../search_method_disambiguate/struct.MyTy.html#impl-X-for-MyTy%3Cbool%3E/method.my_method',
'displayTypeSignature': '*MyTy*<bool> -> *bool*',
},
],
},
Expand All @@ -21,7 +22,8 @@ const EXPECTED = [
{
'path': 'search_method_disambiguate::MyTy',
'name': 'my_method',
'href': '../search_method_disambiguate/struct.MyTy.html#impl-X-for-MyTy%3Cu8%3E/method.my_method'
'href': '../search_method_disambiguate/struct.MyTy.html#impl-X-for-MyTy%3Cu8%3E/method.my_method',
'displayTypeSignature': '*MyTy*<u8> -> *u8*',
},
],
}
Expand Down

0 comments on commit a463f43

Please sign in to comment.