diff options
Diffstat (limited to 'src/tools/rustfmt/tests/target/issue-5488.rs')
-rw-r--r-- | src/tools/rustfmt/tests/target/issue-5488.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/tools/rustfmt/tests/target/issue-5488.rs b/src/tools/rustfmt/tests/target/issue-5488.rs new file mode 100644 index 000000000..0cb37c56f --- /dev/null +++ b/src/tools/rustfmt/tests/target/issue-5488.rs @@ -0,0 +1,17 @@ +// rustfmt-use_field_init_shorthand: true + +struct MyStruct(u32); +struct AnotherStruct { + a: u32, +} + +fn main() { + // Since MyStruct is a tuple struct, it should not be shorthanded to + // MyStruct { 0 } even if use_field_init_shorthand is enabled. + let instance = MyStruct { 0: 0 }; + + // Since AnotherStruct is not a tuple struct, the shorthand should + // apply. + let a = 10; + let instance = AnotherStruct { a }; +} |