Skip to content

feat: ide-assists, Unwrap array #19775

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

A4-Tacks
Copy link
Contributor

Like Unwrap tuple

fn main() {
    $0let [foo, bar] = ["Foo", "Bar"];
}

->

fn main() {
    let foo = "Foo";
    let bar = "Bar";
}

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 10, 2025
@ChayimFriedman2
Copy link
Contributor

I don't know if we should have this, because in my experience arrays (unlike tuples) are rarely used just to assign values to two (or more) variables. That is, when you destructure an array, you have an array and not building it in the same expression. Also, if we decide we want this, this likely needs code deduplication from "unwrap tuple".

@A4-Tacks
Copy link
Contributor Author

Using an array can obtain consistent types, making type inference more convenient.

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