Skip to content

Add a warning about Option/Result::and() being eagerly evaluated #100921

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Aug 25, 2022

Conversation

ChayimFriedman2
Copy link
Contributor

Copied from or().

Inspired by this StackOverflow question.

The PR for or() mentions the Clippy lint or_fun_call which doesn't exist for and() (although there is unnecessary_lazy_evaluations). I still think this warning is also good for and(). Feel free to close if you disagree.

@rustbot rustbot added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Aug 23, 2022
@rust-highfive
Copy link
Contributor

r? @m-ou-se

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 23, 2022
@jyn514 jyn514 added the A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools label Aug 24, 2022
@jyn514
Copy link
Member

jyn514 commented Aug 24, 2022

The PR for or() mentions the Clippy lint or_fun_call which doesn't exist for and()

Sounds like it would make sense to add a clippy lint for and(). Maybe open an issue?

@JohnTitor
Copy link
Member

Looks good, thanks!

r? @JohnTitor @bors r+ rollup

@bors
Copy link
Collaborator

bors commented Aug 24, 2022

📌 Commit eb2fdd9 has been approved by JohnTitor

It is now in the queue for this repository.

@rust-highfive rust-highfive assigned JohnTitor and unassigned m-ou-se Aug 24, 2022
@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 Aug 24, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 25, 2022
Rollup of 8 pull requests

Successful merges:

 - rust-lang#99332 (Stabilize `#![feature(label_break_value)]`)
 - rust-lang#99954 (let-else: break out to one scope higher for let-else)
 - rust-lang#100188 (Parser will not suggest invalid expression when use public)
 - rust-lang#100780 (save_analysis: Migrate diagnostic)
 - rust-lang#100808 (Migrate `rustc_interface` diagnostics )
 - rust-lang#100921 (Add a warning about `Option/Result::and()` being eagerly evaluated)
 - rust-lang#100960 (rustdoc: ayu code color selector more specific)
 - rust-lang#100964 (Sync rustc_codegen_cranelift)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit df354f5 into rust-lang:master Aug 25, 2022
@rustbot rustbot added this to the 1.65.0 milestone Aug 25, 2022
@ChayimFriedman2 ChayimFriedman2 deleted the and-eager-eval branch August 25, 2022 06:09
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library 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