Skip to content

rustdoc: remove explicit boolean comparisons. - #85124

Merged
bors merged 1 commit into
rust-lang:masterfrom
jsha:trust-the-bool
May 12, 2021
Merged

rustdoc: remove explicit boolean comparisons.#85124
bors merged 1 commit into
rust-lang:masterfrom
jsha:trust-the-bool

Conversation

@jsha

@jshajsha commented May 9, 2021

Copy link
Copy Markdown
Contributor

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

@rust-highfive

Copy link
Copy Markdown
Contributor

Some changes occurred in HTML/CSS/JS.

cc @GuillaumeGomez

@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 9, 2021
@GuillaumeGomez

Copy link
Copy Markdown
Member

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

Comment threadsrc/librustdoc/html/static/main.js Outdated
Comment threadsrc/librustdoc/html/static/main.js Outdated
Comment threadsrc/librustdoc/html/static/search.js Outdated
Comment threadsrc/librustdoc/html/static/search.js Outdated

@GuillaumeGomezGuillaumeGomez left a comment

Copy link
Copy Markdown
Member

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!

@rust-log-analyzer

This comment has been minimized.

@bors

bors commented May 10, 2021

Copy link
Copy Markdown
Collaborator

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

@rust-log-analyzer

This comment has been minimized.

Comment threadsrc/librustdoc/html/static/main.js Outdated
@GuillaumeGomezGuillaumeGomez 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.
@GuillaumeGomez

Copy link
Copy Markdown
Member

Thanks!

@bors: r+

@bors

bors commented May 11, 2021

Copy link
Copy Markdown
Collaborator

📌 Commit f510e41 has been approved by GuillaumeGomez

@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 May 11, 2021
@JohnTitorJohnTitor mentioned this pull request 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:masterMay 12, 2021
@rustbotrustbot added this to the 1.54.0 milestone May 12, 2021
@jyn514jyn514 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 freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-rustdoc-jsArea: Rustdoc's JS front-endS-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.

7 participants

@jsha@rust-highfive@GuillaumeGomez@rust-log-analyzer@bors@jyn514@rustbot