Skip to content
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

Hide associated constants too when collapsing implementation #79796

Merged

Conversation

GuillaumeGomez
Copy link
Member

Fixes #71849.

r? @jyn514

@GuillaumeGomez GuillaumeGomez added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. A-rustdoc-ui Area: rustdoc UI (generated HTML) labels Dec 7, 2020
@rust-highfive
Copy link
Collaborator

Some changes occurred in HTML/CSS/JS.

cc @GuillaumeGomez

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 7, 2020
@GuillaumeGomez GuillaumeGomez force-pushed the hide-associated-const-when-collapsing branch from 2d9d966 to c277f37 Compare December 7, 2020 17:15
@GuillaumeGomez
Copy link
Member Author

@pickfire The force of habit. ;)

Copy link
Contributor

@pickfire pickfire left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@GuillaumeGomez
Copy link
Member Author

@bors: r=pickfire rollup

@bors
Copy link
Contributor

bors commented Dec 8, 2020

📌 Commit c277f3726d7b0bef72eb7d78349e14141e17ae99 has been approved by pickfire

@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 Dec 8, 2020
Comment on lines 2260 to 2262
var shouldHide = hasClass(n, "method") || hasClass(n, "associatedconstant");
if (shouldHide === true || fullHide === true || hasClass(n, "type")) {
if (shouldHide === true || fullHide === true) {
Copy link
Member

Choose a reason for hiding this comment

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

Why did you move out the check to fullHide here? There's no time you'd want to treat it separately from the method checks, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, in the case it's an associated constant. ;)

Copy link
Member

Choose a reason for hiding this comment

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

I don't understand what this means. I'm asking why shouldHide is treated separately from fullHide.

Copy link
Contributor

Choose a reason for hiding this comment

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

I did noticed this part but both looks the same to me, either way looks fine but I prefer fullHide being part of shouldHide.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's a bit different: we don't hide "type" elements, only their doc block. So the first condition is either we should completely hide it or its doc block, the second one is if we should hide the element only.

Copy link
Member

Choose a reason for hiding this comment

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

@GuillaumeGomez that's not my question. My question is why did you change from

var shouldHide = hasClass(n, "method") || hasClass(n, "associatedconstant") || fullHide; 
if (shouldHide) { ... }

to

var shouldHide = hasClass(n, "method") || hasClass(n, "associatedconstant"); 
if (shouldHide || fullHide) { ... }

The second is much easier to forget the check to fullHide, and there's no need to make it separate.

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought on the contrary that it made the code easier to follow but I can put back fullHide into the variable.

Copy link
Member

Choose a reason for hiding this comment

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

That would be great, thanks :)

@jyn514
Copy link
Member

jyn514 commented Dec 9, 2020

@bors r-

I would like to get an answer to #79796 (comment) before this merges (even if it's just explaining why the change happened).

@bors bors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Dec 9, 2020
@GuillaumeGomez GuillaumeGomez force-pushed the hide-associated-const-when-collapsing branch from c277f37 to 99df340 Compare December 9, 2020 13:14
@GuillaumeGomez
Copy link
Member Author

@jyn514 I have put back fullHide into the variable.

@GuillaumeGomez
Copy link
Member Author

Forgot to r+ it...

@bors: r=jyn514 rollup

@bors
Copy link
Contributor

bors commented Dec 15, 2020

📌 Commit 99df340 has been approved by jyn514

@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 15, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 15, 2020
…laumeGomez

Rollup of 6 pull requests

Successful merges:

 - rust-lang#79379 (Show hidden elements by default when JS is disabled)
 - rust-lang#79796 (Hide associated constants too when collapsing implementation)
 - rust-lang#79958 (Fixes reported bugs in Rust Coverage)
 - rust-lang#80008 (Fix `cargo-binutils` link)
 - rust-lang#80016 (Use imports instead of rewriting the type signature of `RustcOptGroup::stable`)
 - rust-lang#80025 (Replace some `println!` with `tidy_error!` to simplify)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit bfe49a0 into rust-lang:master Dec 15, 2020
@rustbot rustbot added this to the 1.50.0 milestone Dec 15, 2020
@GuillaumeGomez GuillaumeGomez deleted the hide-associated-const-when-collapsing branch December 15, 2020 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustdoc-ui Area: rustdoc UI (generated HTML) 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.

Rustdoc: strange collapse behaviour when impl block has comment
6 participants