Skip to content

Refactor intra doc link code #76684

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

Merged
merged 3 commits into from
Sep 15, 2020
Merged

Conversation

jyn514
Copy link
Member

@jyn514 jyn514 commented Sep 13, 2020

I got tired of fold_item being 500 lines long.
This is best reviewed one commit at a time with whitespace changes hidden.
There are no logic changes other than the last commit making a parameter checked by the caller instead of the callee.

r? @Manishearth

Previously, `resolve` would immediately check that `module_id` was
non-empty and give an error if not. This had two downsides:

- It introduced `Option`s everywhere, even if the calling function knew
it had a valid module, and
- It checked the module on each namespace, which is unnecessary: it only
needed to be checked once.

This makes the caller responsible for checking the module exists, making
the code a lot simpler.
@jyn514 jyn514 added C-cleanup Category: PRs that clean code up or issues documenting cleanup. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. A-intra-doc-links Area: Intra-doc links, the ability to link to items in docs by name labels Sep 13, 2020
@rust-highfive
Copy link
Contributor

Some changes occurred in intra-doc-links.

cc @jyn514

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 13, 2020
@jyn514
Copy link
Member Author

jyn514 commented Sep 13, 2020

The number of parameters is kind of awful ... I might add a struct that groups them into one.

@jyn514
Copy link
Member Author

jyn514 commented Sep 13, 2020

The number of parameters is kind of awful ... I might add a struct that groups them into one.

Yeah no this had way too many compile errors for me to deal with right now, if I do add it will be in a follow-up PR

}
}
}
match self.resolve_with_disambiguator(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This returns (), not Option. So it can't use ?.

Copy link
Member

@Manishearth Manishearth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@jyn514
Copy link
Member Author

jyn514 commented Sep 13, 2020

@bors r=manishearth

Note to anyone making rollups: this is unlikely to fail any tests, but is extremely likely to conflict with other intra-doc link PRs.

@bors
Copy link
Collaborator

bors commented Sep 13, 2020

📌 Commit 8a13fc4 has been approved by manishearth

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 13, 2020
@bors
Copy link
Collaborator

bors commented Sep 15, 2020

⌛ Testing commit 8a13fc4 with merge c1589cc...

@bors
Copy link
Collaborator

bors commented Sep 15, 2020

☀️ Test successful - checks-actions, checks-azure
Approved by: manishearth
Pushing c1589cc to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 15, 2020
@bors bors merged commit c1589cc into rust-lang:master Sep 15, 2020
@rustbot rustbot added this to the 1.48.0 milestone Sep 15, 2020
@jyn514 jyn514 deleted the refactor-intra-links branch September 15, 2020 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-intra-doc-links Area: Intra-doc links, the ability to link to items in docs by name C-cleanup Category: PRs that clean code up or issues documenting cleanup. merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants