Skip to content

feat: offer on is_some_and for replace_is_method_with_if_let_method#21623

Merged
ShoyuVanilla merged 1 commit intorust-lang:masterfrom
A4-Tacks:replace-is-some-and
Feb 18, 2026
Merged

feat: offer on is_some_and for replace_is_method_with_if_let_method#21623
ShoyuVanilla merged 1 commit intorust-lang:masterfrom
A4-Tacks:replace-is-some-and

Conversation

@A4-Tacks
Copy link
Member

Example

fn main() {
    let x = Some(1);
    if x.is_som$0e_and(|it| it != 3) {}
}

Before this PR

Assist not applicable

After this PR

fn main() {
    let x = Some(1);
    if let Some(it) = x && it != 3 {}
}

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 11, 2026
@A4-Tacks A4-Tacks force-pushed the replace-is-some-and branch 2 times, most recently from d0b4f12 to 3931f9e Compare February 12, 2026 06:36
Example
---
```rust
fn main() {
    let x = Some(1);
    if x.is_som$0e_and(|it| it != 3) {}
}
```

**Before this PR**

Assist not applicable

**After this PR**

```rust
fn main() {
    let x = Some(1);
    if let Some(it) = x && it != 3 {}
}
```
@A4-Tacks A4-Tacks force-pushed the replace-is-some-and branch from 3931f9e to 63126cc Compare February 18, 2026 17:47
@ShoyuVanilla ShoyuVanilla added this pull request to the merge queue Feb 18, 2026
Merged via the queue into rust-lang:master with commit 8e793d9 Feb 18, 2026
16 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 18, 2026
@A4-Tacks A4-Tacks deleted the replace-is-some-and branch February 19, 2026 01:48
@gvozdvmozgu
Copy link
Contributor

Looks like the predicate gets dropped when the argument is not a closure

@A4-Tacks
Copy link
Member Author

A4-Tacks commented Mar 9, 2026

Okay, fixes in #21787

Sign up for free to 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.

4 participants