Skip to content

minor: support unwrap single expr stmt with unit type#22446

Open
A4-Tacks wants to merge 1 commit into
rust-lang:masterfrom
A4-Tacks:unwrap-single-unit-expr-stmt
Open

minor: support unwrap single expr stmt with unit type#22446
A4-Tacks wants to merge 1 commit into
rust-lang:masterfrom
A4-Tacks:unwrap-single-unit-expr-stmt

Conversation

@A4-Tacks
Copy link
Copy Markdown
Member

Example

fn foo() {}
fn main() {
    let f = || {$0 foo(); };
}

Before this PR

Assist not applicable

After this PR

fn foo() {}
fn main() {
    let f = || foo();
}

Example
---
```rust
fn foo() {}
fn main() {
    let f = || {$0 foo(); };
}
```

**Before this PR**

Assist not applicable

**After this PR**

```rust
fn foo() {}
fn main() {
    let f = || foo();
}
```
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 25, 2026
@ChayimFriedman2
Copy link
Copy Markdown
Contributor

I'm conflicted about this. On one hand, this is useful. On the other hand, this assist is supposed to be "dumb", operating over AST. Adding type information to the mix is not necessarily wise.

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.

3 participants