Skip to content

feat: support if-else in value on postfix completions#22222

Merged
ChayimFriedman2 merged 1 commit intorust-lang:masterfrom
A4-Tacks:postfix-if-else-in-value
Apr 30, 2026
Merged

feat: support if-else in value on postfix completions#22222
ChayimFriedman2 merged 1 commit intorust-lang:masterfrom
A4-Tacks:postfix-if-else-in-value

Conversation

@A4-Tacks
Copy link
Copy Markdown
Member

@A4-Tacks A4-Tacks commented Apr 30, 2026

Similar to #20390

Example

fn main() {
    let s = cond.is_some().if$0;
}

Before this PR

fn main() {
    let s = if cond.is_some() {
        $0
    };
}

After this PR

fn main() {
    let s = if cond.is_some() {
        $1
    } else {
        $0
    };
}

Example
---
```rust
fn main() {
    let s = cond.is_some().if$0;
}
```

**Before this PR**

```rust
fn main() {
    let s = if cond.is_some() {
        $0
    };
}
```

**After this PR**

```rust
fn main() {
    let s = if cond.is_some() {
        $1
    } else {
        $0
    };
}
```
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 30, 2026
@ChayimFriedman2 ChayimFriedman2 added this pull request to the merge queue Apr 30, 2026
Merged via the queue into rust-lang:master with commit 9deab80 Apr 30, 2026
18 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 30, 2026
@A4-Tacks A4-Tacks deleted the postfix-if-else-in-value branch April 30, 2026 17:36
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