From 6e05ca87b0c5326ff4f2f7938ba923f8ddd11467 Mon Sep 17 00:00:00 2001 From: Seiichi Uchida Date: Thu, 11 Jan 2018 16:53:13 +0900 Subject: [PATCH] Add a test for #2343 and update tests --- tests/source/issue-2342.rs | 5 +++++ tests/target/attrib.rs | 3 ++- tests/target/configs/struct_field_align_threshold/20.rs | 3 ++- tests/target/enum.rs | 3 ++- tests/target/issue-2342.rs | 6 ++++++ tests/target/struct-field-attributes.rs | 6 ++++-- tests/target/structs.rs | 3 ++- tests/target/unions.rs | 3 ++- 8 files changed, 25 insertions(+), 7 deletions(-) create mode 100644 tests/source/issue-2342.rs create mode 100644 tests/target/issue-2342.rs diff --git a/tests/source/issue-2342.rs b/tests/source/issue-2342.rs new file mode 100644 index 00000000000..f86d24a146b --- /dev/null +++ b/tests/source/issue-2342.rs @@ -0,0 +1,5 @@ +// rustfmt-max_width: 80 + +struct Foo { + #[cfg(feature = "serde")] bytes: [[u8; 17]; 5], // Same size as signature::ED25519_PKCS8_V2_LEN +} diff --git a/tests/target/attrib.rs b/tests/target/attrib.rs index e220b48fb38..43c4f9f327f 100644 --- a/tests/target/attrib.rs +++ b/tests/target/attrib.rs @@ -62,7 +62,8 @@ impl Bar { // #984 struct Foo { - #[derive(Clone, PartialEq, Debug, Deserialize, Serialize)] foo: usize, + #[derive(Clone, PartialEq, Debug, Deserialize, Serialize)] + foo: usize, } // #1668 diff --git a/tests/target/configs/struct_field_align_threshold/20.rs b/tests/target/configs/struct_field_align_threshold/20.rs index 7d8200a0146..b84afc56835 100644 --- a/tests/target/configs/struct_field_align_threshold/20.rs +++ b/tests/target/configs/struct_field_align_threshold/20.rs @@ -40,7 +40,8 @@ pub struct Foo { f : SomeType, // Comment beside a field f: SomeType, // Comment beside a field // Comment on a field - #[AnAttribute] g: SomeOtherType, + #[AnAttribute] + g: SomeOtherType, /// A doc comment on a field h: AThirdType, pub i: TypeForPublicField, diff --git a/tests/target/enum.rs b/tests/target/enum.rs index ac7c835f80a..09578d7ec24 100644 --- a/tests/target/enum.rs +++ b/tests/target/enum.rs @@ -42,7 +42,8 @@ enum StructLikeVariants { StructLike { x: i32, // Test comment // Pre-comment - #[Attr50] y: SomeType, // Aanother Comment + #[Attr50] + y: SomeType, // Aanother Comment }, SL { a: A, diff --git a/tests/target/issue-2342.rs b/tests/target/issue-2342.rs new file mode 100644 index 00000000000..f9c26857e15 --- /dev/null +++ b/tests/target/issue-2342.rs @@ -0,0 +1,6 @@ +// rustfmt-max_width: 80 + +struct Foo { + #[cfg(feature = "serde")] + bytes: [[u8; 17]; 5], // Same size as signature::ED25519_PKCS8_V2_LEN +} diff --git a/tests/target/struct-field-attributes.rs b/tests/target/struct-field-attributes.rs index 8bf10fae3e1..5d6e92a91d9 100644 --- a/tests/target/struct-field-attributes.rs +++ b/tests/target/struct-field-attributes.rs @@ -4,7 +4,8 @@ struct Foo { bar: u64, - #[cfg(test)] qux: u64, + #[cfg(test)] + qux: u64, } fn do_something() -> Foo { @@ -23,7 +24,8 @@ fn main() { // #1462 struct Foo { foo: usize, - #[cfg(feature = "include-bar")] bar: usize, + #[cfg(feature = "include-bar")] + bar: usize, } fn new_foo() -> Foo { diff --git a/tests/target/structs.rs b/tests/target/structs.rs index 2b3647eb8e7..0eedea6933c 100644 --- a/tests/target/structs.rs +++ b/tests/target/structs.rs @@ -8,7 +8,8 @@ pub struct Foo { f : SomeType, // Comment beside a field f: SomeType, // Comment beside a field // Comment on a field - #[AnAttribute] g: SomeOtherType, + #[AnAttribute] + g: SomeOtherType, /// A doc comment on a field h: AThirdType, pub i: TypeForPublicField, diff --git a/tests/target/unions.rs b/tests/target/unions.rs index 2394d9656e4..eb6c3ae7e15 100644 --- a/tests/target/unions.rs +++ b/tests/target/unions.rs @@ -8,7 +8,8 @@ pub union Foo { f : SomeType, // Comment beside a field f: SomeType, // Comment beside a field // Comment on a field - #[AnAttribute] g: SomeOtherType, + #[AnAttribute] + g: SomeOtherType, /// A doc comment on a field h: AThirdType, pub i: TypeForPublicField,