Skip to content

Conversation

GuillaumeGomez
Copy link
Member

Some calls were performed twice (first in is_real_and_local and then in the function calling it). Also the FileName was matched on a few times too.

r? @notriddle

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Dec 3, 2024
@@ -50,8 +50,14 @@ struct LocalSourcesCollector<'a, 'tcx> {
src_root: &'a Path,
}

fn is_real_and_local(span: clean::Span, sess: &Session) -> bool {
span.cnum(sess) == LOCAL_CRATE && span.filename(sess).is_real()
fn is_real_and_local(span: clean::Span, sess: &Session) -> Option<RealFileName> {
Copy link
Contributor

Choose a reason for hiding this comment

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

If it's not a bool function, why would it have an is_ name?

Perhaps it should be called filename_real_and_local instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed. Updated to the suggested name.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 3, 2024
@rust-log-analyzer

This comment has been minimized.

@notriddle
Copy link
Contributor

@bors r+

@bors
Copy link
Collaborator

bors commented Dec 4, 2024

📌 Commit 2997ec5 has been approved by notriddle

It is now in the queue for this repository.

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 4, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 4, 2024
…iaskrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#133651 (Update `NonZero` and `NonNull` to not field-project (per MCP#807))
 - rust-lang#133764 (rustdoc: Rename `set_back_info` to `restore_module_data`.)
 - rust-lang#133784 (Fix MutVisitor's default implementations to visit Stmt's and BinOp's spans)
 - rust-lang#133798 (stop replacing bivariant args with `'static` when computing closure requirements)
 - rust-lang#133804 (Improve code for FileName retrieval in rustdoc)
 - rust-lang#133817 (Use `eprintln` instead of `println` in bootstrap/compiletest/tidy)

Failed merges:

 - rust-lang#133810 (remove unnecessary `eval_verify_bound`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 5530869 into rust-lang:master Dec 4, 2024
6 checks passed
@rustbot rustbot added this to the 1.85.0 milestone Dec 4, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Dec 4, 2024
Rollup merge of rust-lang#133804 - GuillaumeGomez:improve-code, r=notriddle

Improve code for FileName retrieval in rustdoc

Some calls were performed twice (first in `is_real_and_local` and then in the function calling it). Also the `FileName` was matched on a few times too.

r? `@notriddle`
@GuillaumeGomez GuillaumeGomez deleted the improve-code branch December 4, 2024 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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