8000 Fix apply in inner if for pull_assignment_up by A4-Tacks · Pull Request #20722 · rust-lang/rust-analyzer · GitHub
[go: up one dir, main page]

Skip to content

Conversation

A4-Tacks
Copy link
Contributor

Example

fn foo() {
    let mut a = 1;

    if true {
        a = 2;
    } else if true {
        $0a = 3;
    } else {
        a = 4;
    }
}

Before this PR:

fn foo() {
    let mut a = 1;

    if true {
        a = 2;
    } else a = if true {
        3
    } else {
        4
    };
}

After this PR:

fn foo() {
    let mut a = 1;

    a = if true {
        2
    } else if true {
        3
    } else {
        4
    };
}

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 22, 2025
Example
---
```rust
fn foo() {
    let mut a = 1;

    if true {
        a = 2;
    } else if true {
        $0a = 3;
    } else {
        a = 4;
    }
}
```

**Before this PR**:

```rust
fn foo() {
    let mut a = 1;

    if true {
        a = 2;
    } else a = if true {
        3
    } else {
        4
    };
}
```

**After this PR**:

```rust
fn foo() {
    let mut a = 1;

    a = if true {
        2
    } else if true {
        3
    } else {
        4
    };
}
```
@A4-Tacks A4-Tacks force-pushed the pull-assign-up-inner-if branch from ae9b164 to 23535a6 Compare September 22, 2025 06:33
Copy link
Member
@ShoyuVanilla ShoyuVanilla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@ShoyuVanilla ShoyuVanilla added this pull request to the merge queue Sep 22, 2025
Merged via the queue into rust-lang:master with commit d6e14cc Sep 22, 2025
15 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 22, 2025
@A4-Tacks A4-Tacks deleted the pull-assign-up-inner-if branch September 22, 2025 23:06
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.

3 participants

0