From fff59fe8d9eccb6cd234efa9316533ddf6cd1302 Mon Sep 17 00:00:00 2001 From: Seiichi Uchida Date: Mon, 22 Jan 2018 13:03:48 +0900 Subject: [PATCH] Add a test for field initialization shorthand --- tests/source/init_shorthand.rs | 18 ++++++++++++++++++ tests/target/init_shorthand.rs | 14 ++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 tests/source/init_shorthand.rs create mode 100644 tests/target/init_shorthand.rs diff --git a/tests/source/init_shorthand.rs b/tests/source/init_shorthand.rs new file mode 100644 index 000000000000..31c8fa294ad9 --- /dev/null +++ b/tests/source/init_shorthand.rs @@ -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, + }; +} diff --git a/tests/target/init_shorthand.rs b/tests/target/init_shorthand.rs new file mode 100644 index 000000000000..be315fff35ca --- /dev/null +++ b/tests/target/init_shorthand.rs @@ -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, + }; +}