-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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: Cleanup associated const value rendering #42286
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
@@ -498,13 +488,9 @@ fn resolved_path(w: &mut fmt::Formatter, did: DefId, path: &clean::Path, | |||
} else { | |||
root.push_str(&seg.name); | |||
root.push_str("/"); | |||
if is_not_debug { |
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.
I'm pretty surprised that we have the same outcome in here.
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.
With w.alternate() == true
it does write!(w, "{}::", seg.name)?;
, as can be seen above. The is_not_debug == false
case did exactly the same thing.
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.
Oh I see!
} else { | ||
write!(f, "{:#}::", self_type)? | ||
} | ||
if should_show_cast { |
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.
Once again I'm surprised the code does the same thing.
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.
The is_not_debug == false
case was:
if should_show_cast {
write!(f, "<{:?} as {:?}>::", self_type, trait_)?
} else {
write!(f, "{:?}::", self_type)?
}
The f.alternate() == true
case is:
if should_show_cast {
write!(f, "<{:#} as {:#}>::", self_type, trait_)?
} else {
write!(f, "{:#}::", self_type)?
}
Just waiting for some other people to review as well to confirm I didn't miss anything. cc @rust-lang/dev-tools |
@bors: r+ thanks so much! |
📌 Commit ef9b2e8 has been approved by |
☔ The latest upstream changes (presumably #42318) made this pull request unmergeable. Please resolve the merge conflicts. |
ef9b2e8
to
6df7535
Compare
I've rebased and redone #42318. |
Rather than (ab)using Debug for outputting the type in plain text use the alternate format parameter which already does exactly that. This fixes type parameters for example which would output raw HTML. Also cleans up adding parens around references to trait objects.
6df7535
to
86ea93e
Compare
} else { | ||
write!(f, "&{}{}", lt, m)?; | ||
} | ||
write!(f, "(")?; |
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.
Oh I see. Better indeed!
Thanks for the update and the improvement! @bors: r+ |
📌 Commit 86ea93e has been approved by |
…laumeGomez rustdoc: Cleanup associated const value rendering Rather than (ab)using Debug for outputting the type in plain text use the alternate format parameter which already does exactly that. This fixes type parameters for example which would output raw HTML. Also cleans up adding parens around references to trait objects.
…laumeGomez rustdoc: Cleanup associated const value rendering Rather than (ab)using Debug for outputting the type in plain text use the alternate format parameter which already does exactly that. This fixes type parameters for example which would output raw HTML. Also cleans up adding parens around references to trait objects.
Rather than (ab)using Debug for outputting the type in plain text use the
alternate format parameter which already does exactly that. This fixes
type parameters for example which would output raw HTML.
Also cleans up adding parens around references to trait objects.