Skip to content

Emit intrinsic lazily - #13436

Merged
bors merged 1 commit into
rust-lang:masterfrom
pongad:lazyemit
Apr 10, 2014
Merged

Emit intrinsic lazily#13436
bors merged 1 commit into
rust-lang:masterfrom
pongad:lazyemit

Conversation

@pongad

Copy link
Copy Markdown
Contributor

Fixes#11926

bors added a commit that referenced this pull request Apr 10, 2014
@borsbors closed this Apr 10, 2014
@bors
bors merged commit a00be50 into rust-lang:masterApr 10, 2014
flip1995 pushed a commit to flip1995/rust that referenced this pull request Oct 3, 2024
…, r=xFrednet
Simplify negative `Option::{is_some_and,is_none_or}`
Closesrust-lang#13436.
Improved based on the existing lint `nonminimal_bool`, since there is already handling of similar methods `Option::{is_some,is_none}` and `Result::{is_ok,is_err}`, and there is a lot of reusable code.
When `is_some_and` or `is_none_or` have a negation, we invert it into another method by removing the Not sign and inverting the expression in the closure.
For the case where the closure block has statements, currently no simplification is implemented. (Should we do it?)
```rust
// Currently will not simplify this
_ = !opt.is_some_and(|x| {
let complex_block = 100;
x == complex_block
});
```
changelog: [`nonminimal_bool`]: Simplify negative `Option::{is_some_and,is_none_or}`
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

emit intrinsic declarations lazily

2 participants

@pongad@bors