-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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: stop treating everything in a trait item as a method #105629
rustdoc: stop treating everything in a trait item as a method #105629
Conversation
(rustbot has picked a reviewer for you, use r? to override) |
@@ -732,7 +732,8 @@ fn item_trait(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &clean: | |||
document(&mut content, cx, m, Some(t), HeadingOffset::H5); | |||
let toggled = !content.is_empty(); | |||
if toggled { | |||
write!(w, "<details class=\"rustdoc-toggle method-toggle\" open><summary>"); | |||
let method_toggle_class = if item_type.is_method() { " method-toggle" } else { "" }; | |||
write!(w, "<details class=\"rustdoc-toggle{method_toggle_class}\" open><summary>"); |
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.
Actually: why do we have both rustdoc-toggle
and method-toggle
?
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 setting "Auto-hide item methods' documentation" treats it special:
rust/src/librustdoc/html/static/js/main.js
Lines 688 to 690 in 37d7de3
if (hideMethodDocs && hasClass(e, "method-toggle")) { | |
e.open = false; | |
} |
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. Maybe we should extend this setting to all items which have docs. To be discussed later on I suppose.
Thanks! @bors r+ rollup |
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#104864 (Account for item-local in inner scope for E0425) - rust-lang#105332 (Point out the type of associated types in every method call of iterator chains) - rust-lang#105620 (Remove unnecessary uses of `clone`) - rust-lang#105625 (minor code cleanups) - rust-lang#105629 (rustdoc: stop treating everything in a trait item as a method) - rust-lang#105636 (Add check for local-storage value when changing "display line numbers" settings) - rust-lang#105639 (rustdoc: remove `type="text/css" from stylesheet links) - rust-lang#105640 (Adjust miri to still be optional) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This was added in 0b9b4b7 to fix the spacing on trait pages, but stopped being needed because 791f04e stopped styling method-toggle. By only putting the method-toggle class on actual methods, the JS setting does the right thing.