Skip to content

Support richer tuple unpacking #3736

Closed
Closed
@tav

Description

@tav

I'm not sure if it's less efficient to do:

let mut (a, b, c, d) = (self.x[0], self.x[1], self.x[2], self.x[3]);

Than:

let mut a = self.x[0];
let mut b = self.x[1];
let mut c = self.x[2];
let mut d = self.x[3];

But I find the former a lot easier to type in some cases. It'd be nice to know if destructuring of this kind is a valid use of tuple unpacking in Rust.

It'd also be nice if the following was legal:

let (self.x[0], self.x[1], self.x[2], self.x[3]) = (a, b, c, d);

Right now the above dies with the following error:

expected `,` but found `.`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions