mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-16 21:15:18 +03:00
Add a test for field initialization shorthand
This commit is contained in:
@@ -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,
|
||||
};
|
||||
}
|
||||
@@ -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,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user