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

rustdoc: remove explicit boolean comparisons. #85124

Merged
merged 1 commit into from
May 12, 2021

Conversation

jsha
Copy link
Contributor

@jsha jsha commented May 9, 2021

For boolean variables it's shorter and more readable to check the value directly, or negate it with !.

In a couple of cases I reordered an if/else pair because it made the initial if statement simpler.

An example of a style guide recommending this: https://airbnb.io/javascript/#comparison--shortcuts

r? @GuillaumeGomez

@jsha jsha added A-rustdoc-js Area: Rustdoc's JS front-end T-rustdoc labels May 9, 2021
@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 May 9, 2021
@GuillaumeGomez
Copy link
Member

Just checked and apparently, it doesn't seem to impact boolean comparisons, only the other types.

Copy link
Member

@GuillaumeGomez GuillaumeGomez left a comment

Choose a reason for hiding this comment

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

A few things to change but otherwise looks good, thanks!

@jsha jsha force-pushed the trust-the-bool branch from 10c968d to ded7cca Compare May 10, 2021 06:13
@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented May 10, 2021

☔ The latest upstream changes (presumably #85074) made this pull request unmergeable. Please resolve the merge conflicts.

@jsha jsha force-pushed the trust-the-bool branch from ded7cca to 2f2fb68 Compare May 10, 2021 13:55
@rust-log-analyzer

This comment has been minimized.

@jsha jsha force-pushed the trust-the-bool branch from 2f2fb68 to b21868e Compare May 10, 2021 22:59
@GuillaumeGomez GuillaumeGomez 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-review Status: Awaiting review from the assignee but also interested parties. labels May 11, 2021
For boolean variables it's shorter and more readable to check the value
directly, or negate it with `!`.

In a couple of cases I reordered an if/else pair because it made the
initial `if` statement simpler.

Removed unused isType parameter from two functions.
@jsha jsha force-pushed the trust-the-bool branch from b21868e to f510e41 Compare May 11, 2021 17:51
@GuillaumeGomez
Copy link
Member

Thanks!

@bors: r+

@bors
Copy link
Contributor

bors commented May 11, 2021

📌 Commit f510e41 has been approved by GuillaumeGomez

@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 May 11, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request May 11, 2021
Rollup of 8 pull requests

Successful merges:

 - rust-lang#83501 (rustdoc: Add unstable CLI option to show basic type layout information)
 - rust-lang#85018 (shrinking the deprecated method span)
 - rust-lang#85124 (rustdoc: remove explicit boolean comparisons.)
 - rust-lang#85136 (Change param name (k to key and v to value) in std::env module)
 - rust-lang#85162 (Fix typo in variable name)
 - rust-lang#85187 (Use .name_str() to format primitive types in error messages)
 - rust-lang#85191 (Improve rustdoc gui tester)
 - rust-lang#85196 (Revert "Auto merge of rust-lang#84797 - richkadel:cover-unreachable-statements…)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 4ab3050 into rust-lang:master May 12, 2021
@rustbot rustbot added this to the 1.54.0 milestone May 12, 2021
@jyn514 jyn514 added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Jun 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustdoc-js Area: Rustdoc's JS front-end 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.

7 participants