Skip to content

Fix other predicate for replace_is_method_with_if_let_method#21787

Open
A4-Tacks wants to merge 1 commit intorust-lang:masterfrom
A4-Tacks:replace-is-some-and-fallback
Open

Fix other predicate for replace_is_method_with_if_let_method#21787
A4-Tacks wants to merge 1 commit intorust-lang:masterfrom
A4-Tacks:replace-is-some-and-fallback

Conversation

@A4-Tacks
Copy link
Member

@A4-Tacks A4-Tacks commented Mar 9, 2026

  • Fix parentheses for replace_is_method_with_if_let_method

Example

fn main() {
    let x = Some(1);
    if x.is_som$0e_and(predicate) {}
}

Before this PR

fn main() {
    let x = Some(1);
    if let Some(x1) = x {}
}

After this PR

fn main() {
    let x = Some(1);
    if let Some(x1) = x && predicate(x1) {}
}

- Fix parentheses for replace_is_method_with_if_let_method

Example
---
```rust
fn main() {
    let x = Some(1);
    if x.is_som$0e_and(predicate) {}
}
```

**Before this PR**

```rust
fn main() {
    let x = Some(1);
    if let Some(x1) = x {}
}
```

**After this PR**

```rust
fn main() {
    let x = Some(1);
    if let Some(x1) = x && predicate(x1) {}
}
```
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants