rustdoc: add disambiguators for identically named method in sidebar - #162778
Open
lolbinarycat wants to merge 1 commit into
Open
lolbinarycat wants to merge 1 commit into
lolbinarycat wants to merge 1 commit into
Conversation
Collaborator
|
rustbot has assigned @GuillaumeGomez. Use Why was this reviewer chosen?The reviewer was selected based on:
|
| Cow::Borrowed(s) => *s = &s[..len], | ||
| Cow::Owned(s) => s.truncate(len), | ||
| }; | ||
| fn get_shortname<'a>(itm: Option<&'a Link<'a>>) -> Option<&'a str> { |
Member
There was a problem hiding this comment.
Just a nit:
Suggested change
| fn get_shortname<'a>(itm: Option<&'a Link<'a>>) -> Option<&'a str> { | |
| fn get_short_name<'a>(item: Option<&'a Link<'a>>) -> Option<&'a str> { |
| }) | ||
| } | ||
|
|
||
| fn postprocess_method_list(ml: &mut [Link<'_>]) { |
Member
There was a problem hiding this comment.
Suggested change
| fn postprocess_method_list(ml: &mut [Link<'_>]) { | |
| fn postprocess_method_list(methods: &mut [Link<'_>]) { |
Comment on lines
+809
to
+814
| let cur_sn = get_shortname(ml.get(i)); | ||
| if get_shortname(ml.get(i.wrapping_sub(1))) != cur_sn | ||
| && cur_sn != get_shortname(ml.get(i + 1)) | ||
| { | ||
| let csnl = cur_sn.unwrap().len(); | ||
| trunc_to(&mut ml[i].name, csnl); |
Member
There was a problem hiding this comment.
Bigger suggestion then:
Suggested change
| let cur_sn = get_shortname(ml.get(i)); | |
| if get_shortname(ml.get(i.wrapping_sub(1))) != cur_sn | |
| && cur_sn != get_shortname(ml.get(i + 1)) | |
| { | |
| let csnl = cur_sn.unwrap().len(); | |
| trunc_to(&mut ml[i].name, csnl); | |
| let Some(short_name) = get_short_name(methods.get(i)) else { continue }; | |
| if i > 0 | |
| && get_short_name(methods.get(i - 1)) != Some(short_name) | |
| && Some(short_name) != get_short_name(methods.get(i + 1)) | |
| { | |
| let current_len = short_name.len(); | |
| trunc_to(&mut methods[i].name, current_len); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #142147
also affects associated fns. main improvments are to pointer and box docs.
before:

after:
