Skip to content

Cover the short form match arm syntax Point { x, y } in addition to Point { x: x, y: y } #25779

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

Closed
nliberg opened this issue May 25, 2015 · 1 comment

Comments

@nliberg
Copy link
Contributor

nliberg commented May 25, 2015

The patterns.md page doesn't explain that it's possible to match compound data in this way:
match origin { Point { x, y, .. } => ()
Currently only this form is covered:
match origin { Point { x: x, y: y, .. } => ()

The latter form results in compiler warnings (warning: the y: in this pattern is redundant and can be removed). I'm not sure whether it should be avoided for that reason.

Marwes added a commit to Marwes/rust that referenced this issue Jun 7, 2015
Adds a mention for the short form pattern syntax.

rust-lang#25779
Marwes added a commit to Marwes/rust that referenced this issue Jun 12, 2015
Explains short form pattern syntax and then introduces the longer
pattern matching as a rebinding of the fields instead.

 rust-lang#25779
bors added a commit that referenced this issue Jun 13, 2015
Adds a mention for the short form pattern syntax. Now without creating a PR to my own fork!

#25779
@steveklabnik
Copy link
Member

#26108 fixed this

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