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, + }; +}