Skip to content

Conversation

A4-Tacks
Copy link
Contributor

This transforms if x {} else { if y {} } into if x {} else if y {},
This assist can only be applied with the cursor on else.

Example

fn main() {
    if x == 3 {
        true
    } $0else {
        if x == 2 {
            false
        } else {
            true
        }
    }
}

->

fn main() {
    if x == 3 {
        true
    } else if x == 2 {
        false
    } else {
        true
    }
}

This transforms `if x {} else { if y {} }` into `if x {} else if y {}`,
This assist can only be applied with the cursor on `else`.

Example
---
```rust
fn main() {
    if x == 3 {
        true
    } $0else {
        if x == 2 {
            false
        } else {
            true
        }
    }
}
```
->
```rust
fn main() {
    if x == 3 {
        true
    } else if x == 2 {
        false
    } else {
        true
    }
}
```
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 18, 2025
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