Add a test for field initialization shorthand

This commit is contained in:
Seiichi Uchida 2018-01-22 13:03:48 +09:00
parent 8e6ee4a762
commit fff59fe8d9
2 changed files with 32 additions and 0 deletions

View file

@ -0,0 +1,18 @@
// Use field initialization shorthand if possible.
fn main() {
let a = Foo {
x: x,
y: y,
z: z,
};
let b = Bar {
x: x,
y: y,
#[attr]
z: z,
#[rustfmt_skip]
skipped: skipped,
};
}

View file

@ -0,0 +1,14 @@
// Use field initialization shorthand if possible.
fn main() {
let a = Foo { x, y, z };
let b = Bar {
x,
y,
#[attr]
z,
#[rustfmt_skip]
skipped: skipped,
};
}