Improve grammar on field init docs

This commit is contained in:
Jake Goulding 2017-02-11 23:42:39 -05:00 committed by Manish Goregaokar
parent 165c4be2e2
commit b01642916b
1 changed files with 2 additions and 6 deletions

View File

@ -2819,12 +2819,8 @@ Point3d {y: 0, z: 10, .. base};
#### Struct field init shorthand
When initializing a data structure (struct, enum, union) with named fields,
allow writing `fieldname` as a shorthand for `fieldname: fieldname`. This
allows a compact syntax for initialization, with less duplication.
In the initializer for a `struct` with named fields, a `union` with named
fields, or an enum variant with named fields, accept an identifier `field` as a
shorthand for `field: field`.
it is allowed to write `fieldname` as a shorthand for `fieldname: fieldname`.
This allows a compact syntax with less duplication.
Example: