Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustdoc: don't hyperlink square brackets in method signatures #91173

Closed
jsha opened this issue Nov 24, 2021 · 1 comment · Fixed by #98069
Closed

rustdoc: don't hyperlink square brackets in method signatures #91173

jsha opened this issue Nov 24, 2021 · 1 comment · Fixed by #98069
Labels
A-rustdoc-ui Area: Rustdoc UI (generated HTML) T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@jsha
Copy link
Contributor

jsha commented Nov 24, 2021

For example, in https://doc.rust-lang.org/nightly/std/primitive.slice.html#method.get, the method signature contains a [T]:

image

In that method signature, all four instances of [ or ] are colored and hyperlinked (to https://doc.rust-lang.org/nightly/std/primitive.slice.html).

These hyperlinks aren't very useful. For one thing, they present a very tiny click target, which is bad UX. For another thing, it's quite rare to be reading Rust documentation and needs to clarify that the [ and ] indicate a slice. We should remove these and save a little bit of page size.

@jsha jsha added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. A-rustdoc-ui Area: Rustdoc UI (generated HTML) labels Nov 24, 2021
@eggyal
Copy link
Contributor

eggyal commented Dec 11, 2021

I've actually found those links to the slice docs quite useful, on a number of occasions.

Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Jun 14, 2022
…, r=jsha

rustdoc:  remove link on slice brackets

This is rust-lang#91778, take two.

Fixes rust-lang#91173

The reason I'm reevaluating this change is rust-lang#97668, which makes fully-generic slices link to the slice docs page. This fixes some downsides in the original PR, where `Box<[T]>`, for example, was not linked to the primitive.slice.html page. In this PR, the `[T]` inside is still a link.

The other major reason for wanting to reevaluate this is the changed color scheme. When this feature was first introduced in rustdoc, primitives were a different color from structs and enums. This way, eagle-eyed users could figure out that the square brackets were separate links from the structs inside. Now, all types have the same color, so a significant fraction of users won't even know the links are there unless they pay close attention to the status bar or use an accessibility tool that lists all links on the page.
@bors bors closed this as completed in 27f7805 Jun 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustdoc-ui Area: Rustdoc UI (generated HTML) T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
2 participants