Skip to content
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

Support richer tuple unpacking #3736

Closed
tav opened this issue Oct 12, 2012 · 1 comment
Closed

Support richer tuple unpacking #3736

tav opened this issue Oct 12, 2012 · 1 comment

Comments

@tav
Copy link
Contributor

tav commented Oct 12, 2012

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 `.`
@nikomatsakis
Copy link
Contributor

The first example should work, though it is indeed somewhat less efficient. The second does not work because what appears after let is a pattern, not just a list of lvalues.

bors added a commit that referenced this issue Feb 3, 2019
submodule: update clippy from 6ce78d1 to 3bda548

rust-lang/rust-clippy@6ce78d1...3bda548

Rustup: unused trim result
Auto merge of #3727 - phansch:rustup_unused_trim, r=matthiaskrgr  …
Travis: Don't run integration tests on every PR commit  …
Auto merge of #3726 - phansch:some_renaming, r=oli-obk  …
Fix ICE in vec_box lint and add run-rustfix  …
Make vec_box MachineApplicable
Remove conditionals from base builds  …
Adding lint for too many lines.
Updating number of lines for the failing test to be > 100.  …
Running util/dev to update README/CHANGELOG
Reworking function logic, and adding doc example.  …
Moving tests to ui-toml to make use of clippy.toml
rustfmt
Adding back tests, but also reducing threshold by 1
Updating to just warn for one test.
Fix test broken by removing comment.
Skipping check if in external macro.
Adding lint for too many lines.
Updating number of lines for the failing test to be > 100.  …
Moving tests to ui-toml to make use of clippy.toml
rustfmt
Adding back tests, but also reducing threshold by 1
Updating to just warn for one test.
Fix test broken by removing comment.
Changing single character string to a character match.
Updated readme.
Updating code to ignore rustfmt issue.
phansch and avborhanian
Update clippy_lints/src/types.rs  …
Update clippy_lints/src/types.rs  …
Auto merge of #3732 - phansch:fix_ice_3720, r=oli-obk  …
Auto merge of #3731 - phansch:travis, r=phansch  …
Auto merge of #2857 - avborhanian:master, r=phansch  …
Fix breakage due to #58079  …
Auto merge of #3736 - mikerite:fix-build-20190203, r=phansch  …

related with: #58024
RalfJung pushed a commit to RalfJung/rust that referenced this issue Jul 14, 2024
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

No branches or pull requests

2 participants