-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Improve code for FileName retrieval in rustdoc #133804
Conversation
src/librustdoc/html/sources.rs
Outdated
@@ -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> { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
This comment has been minimized.
This comment has been minimized.
b885c29
to
2997ec5
Compare
@bors r+ |
…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
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`
Some calls were performed twice (first in
is_real_and_local
and then in the function calling it). Also theFileName
was matched on a few times too.r? @notriddle