Skip to content

Remove under-used ImplPolarity enum - #80825

Merged
bors merged 2 commits into
rust-lang:masterfrom
GuillaumeGomez:rustdoc-cleanup-bis-repetita
Jan 10, 2021
Merged

Remove under-used ImplPolarity enum#80825
bors merged 2 commits into
rust-lang:masterfrom
GuillaumeGomez:rustdoc-cleanup-bis-repetita

Conversation

@GuillaumeGomez

Copy link
Copy Markdown
Member

It doesn't make much sense to have an enum with only two possible values and to store it inside an Option in my opinion when you can do all the same with a simple boolean. I don't expect any chances, performance or RSS usage wise.

r? @jyn514

@GuillaumeGomezGuillaumeGomez added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Jan 8, 2021
@GuillaumeGomez
GuillaumeGomezforce-pushed the rustdoc-cleanup-bis-repetita branch from 499e65f to 28e8dafCompareJanuary 8, 2021 21:59
@cjgillot

Copy link
Copy Markdown
Contributor

Could the similar rustc_ast::ast::ImplPolarity enum be reused? This would bring rustdoc IR closer to the backing HIR.

@GuillaumeGomez

Copy link
Copy Markdown
MemberAuthor

The only one we seem to interact with is rustc_middle::ty::ImplPolarity. So not sure if it'd be a good idea to bring another type from earlier stages.

@jyn514

Copy link
Copy Markdown
Member

What does an impl polarity of None currently mean?

I don't think it's clear at all that true and false mean 'positive impl' and 'negative impl'. I would rather have an enum for that, at which point I think it makes more sense to use ast::Polarity or ty::Polarity.

@GuillaumeGomez

Copy link
Copy Markdown
MemberAuthor

What does an impl polarity of None currently mean?

It's treated as "non-negative impl". Which is why I turned it into a boolean.

I don't think it's clear at all that true and false mean 'positive impl' and 'negative impl'. I would rather have an enum for that, at which point I think it makes more sense to use ast::Polarity or ty::Polarity.

If you prefer. I think it's a bit too much considering how little use of it we make. Don't you confirm your choice? ;)

@GuillaumeGomez
GuillaumeGomezforce-pushed the rustdoc-cleanup-bis-repetita branch from 28e8daf to d6c35b0CompareJanuary 8, 2021 23:21
@GuillaumeGomez

Copy link
Copy Markdown
MemberAuthor

After a talk, we agreed on keeping the boolean but to rename the field from polarity to negative_polarity to make it more obvious what this was about.

Comment threadsrc/librustdoc/clean/blanket_impl.rs Outdated
Comment threadsrc/librustdoc/clean/mod.rs Outdated
Comment threadsrc/librustdoc/html/render/mod.rs Outdated
@jyn514jyn514 added C-cleanup Category: PRs that clean code up or issues documenting cleanup. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 8, 2021
@GuillaumeGomez
GuillaumeGomezforce-pushed the rustdoc-cleanup-bis-repetita branch from d6c35b0 to 34d128aCompareJanuary 9, 2021 13:59
@jyn514

Copy link
Copy Markdown
Member

r=me with CI passing

@GuillaumeGomez

Copy link
Copy Markdown
MemberAuthor

@bors: r=jyn514

@bors

bors commented Jan 9, 2021

Copy link
Copy Markdown
Collaborator

📌 Commit 34d128a has been approved by jyn514

@borsbors 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 Jan 9, 2021
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Jan 10, 2021
…repetita, r=jyn514
Remove under-used ImplPolarity enum
It doesn't make much sense to have an enum with only two possible values and to store it inside an `Option` in my opinion when you can do all the same with a simple boolean. I don't expect any chances, performance or RSS usage wise.
r? `@jyn514`
This was referenced Jan 10, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 10, 2021
Rollup of 9 pull requests
Successful merges:
- rust-lang#79502 (Implement From<char> for u64 and u128.)
- rust-lang#79968 (Improve core::ptr::drop_in_place debuginfo)
- rust-lang#80774 (Fix safety comment)
- rust-lang#80801 (Use correct span for structured suggestion)
- rust-lang#80803 (Remove useless `fill_in` function)
- rust-lang#80820 (Support `download-ci-llvm` on NixOS)
- rust-lang#80825 (Remove under-used ImplPolarity enum)
- rust-lang#80850 (Allow #[rustc_builtin_macro = "name"])
- rust-lang#80857 (Add comment to `Vec::truncate` explaining `>` vs `>=`)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
@bors
bors merged commit 5acac4c into rust-lang:masterJan 10, 2021
@rustbotrustbot added this to the 1.51.0 milestone Jan 10, 2021
@GuillaumeGomez
GuillaumeGomez deleted the rustdoc-cleanup-bis-repetita branch January 10, 2021 12:10
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-cleanupCategory: PRs that clean code up or issues documenting cleanup.S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-rustdocRelevant 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

@GuillaumeGomez@cjgillot@jyn514@bors@rustbot