From aa4cd311bb07ea25d89096e8fdd5d64b73666c28 Mon Sep 17 00:00:00 2001 From: est31 Date: Tue, 6 Jun 2017 03:11:17 +0200 Subject: Add config options for spaces around the colon in struct literal fields In Rust, colons are used for three purposes: * Type annotations, including type ascription * Trait bounds * Struct literal fields This commit adds options for the last missing of the three purposes, struct literal fields. --- tests/source/configs-space_after_struct_lit_field_colon-false.rs | 6 ++++++ tests/source/configs-space_after_struct_lit_field_colon-true.rs | 6 ++++++ tests/source/configs-space_before_struct_lit_field_colon-false.rs | 6 ++++++ tests/source/configs-space_before_struct_lit_field_colon-true.rs | 6 ++++++ tests/target/configs-space_after_struct_lit_field_colon-false.rs | 6 ++++++ tests/target/configs-space_after_struct_lit_field_colon-true.rs | 6 ++++++ tests/target/configs-space_before_struct_lit_field_colon-false.rs | 6 ++++++ tests/target/configs-space_before_struct_lit_field_colon-true.rs | 6 ++++++ tests/target/space-before-type-annotation.rs | 2 +- tests/target/space-not-after-type-annotation-colon.rs | 2 +- 10 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 tests/source/configs-space_after_struct_lit_field_colon-false.rs create mode 100644 tests/source/configs-space_after_struct_lit_field_colon-true.rs create mode 100644 tests/source/configs-space_before_struct_lit_field_colon-false.rs create mode 100644 tests/source/configs-space_before_struct_lit_field_colon-true.rs create mode 100644 tests/target/configs-space_after_struct_lit_field_colon-false.rs create mode 100644 tests/target/configs-space_after_struct_lit_field_colon-true.rs create mode 100644 tests/target/configs-space_before_struct_lit_field_colon-false.rs create mode 100644 tests/target/configs-space_before_struct_lit_field_colon-true.rs (limited to 'tests') diff --git a/tests/source/configs-space_after_struct_lit_field_colon-false.rs b/tests/source/configs-space_after_struct_lit_field_colon-false.rs new file mode 100644 index 00000000000..3ee99fa5d1d --- /dev/null +++ b/tests/source/configs-space_after_struct_lit_field_colon-false.rs @@ -0,0 +1,6 @@ +// rustfmt-space_after_struct_lit_field_colon: false + +const LOREM: Lorem = Lorem { + ipsum:dolor, + sit : amet, +}; diff --git a/tests/source/configs-space_after_struct_lit_field_colon-true.rs b/tests/source/configs-space_after_struct_lit_field_colon-true.rs new file mode 100644 index 00000000000..6105d4725d8 --- /dev/null +++ b/tests/source/configs-space_after_struct_lit_field_colon-true.rs @@ -0,0 +1,6 @@ +// rustfmt-space_after_struct_lit_field_colon: true + +const LOREM: Lorem = Lorem { + ipsum:dolor, + sit : amet, +}; diff --git a/tests/source/configs-space_before_struct_lit_field_colon-false.rs b/tests/source/configs-space_before_struct_lit_field_colon-false.rs new file mode 100644 index 00000000000..a2d71c8bf0b --- /dev/null +++ b/tests/source/configs-space_before_struct_lit_field_colon-false.rs @@ -0,0 +1,6 @@ +// rustfmt-space_before_struct_lit_field_colon: false + +const LOREM: Lorem = Lorem { + ipsum:dolor, + sit : amet, +}; diff --git a/tests/source/configs-space_before_struct_lit_field_colon-true.rs b/tests/source/configs-space_before_struct_lit_field_colon-true.rs new file mode 100644 index 00000000000..50e4ba12d82 --- /dev/null +++ b/tests/source/configs-space_before_struct_lit_field_colon-true.rs @@ -0,0 +1,6 @@ +// rustfmt-space_before_struct_lit_field_colon: true + +const LOREM: Lorem = Lorem { + ipsum:dolor, + sit : amet, +}; diff --git a/tests/target/configs-space_after_struct_lit_field_colon-false.rs b/tests/target/configs-space_after_struct_lit_field_colon-false.rs new file mode 100644 index 00000000000..8f475059464 --- /dev/null +++ b/tests/target/configs-space_after_struct_lit_field_colon-false.rs @@ -0,0 +1,6 @@ +// rustfmt-space_after_struct_lit_field_colon: false + +const LOREM: Lorem = Lorem { + ipsum:dolor, + sit:amet, +}; diff --git a/tests/target/configs-space_after_struct_lit_field_colon-true.rs b/tests/target/configs-space_after_struct_lit_field_colon-true.rs new file mode 100644 index 00000000000..34fb792dcb5 --- /dev/null +++ b/tests/target/configs-space_after_struct_lit_field_colon-true.rs @@ -0,0 +1,6 @@ +// rustfmt-space_after_struct_lit_field_colon: true + +const LOREM: Lorem = Lorem { + ipsum: dolor, + sit: amet, +}; diff --git a/tests/target/configs-space_before_struct_lit_field_colon-false.rs b/tests/target/configs-space_before_struct_lit_field_colon-false.rs new file mode 100644 index 00000000000..48336954786 --- /dev/null +++ b/tests/target/configs-space_before_struct_lit_field_colon-false.rs @@ -0,0 +1,6 @@ +// rustfmt-space_before_struct_lit_field_colon: false + +const LOREM: Lorem = Lorem { + ipsum: dolor, + sit: amet, +}; diff --git a/tests/target/configs-space_before_struct_lit_field_colon-true.rs b/tests/target/configs-space_before_struct_lit_field_colon-true.rs new file mode 100644 index 00000000000..e4f1cdb4575 --- /dev/null +++ b/tests/target/configs-space_before_struct_lit_field_colon-true.rs @@ -0,0 +1,6 @@ +// rustfmt-space_before_struct_lit_field_colon: true + +const LOREM: Lorem = Lorem { + ipsum : dolor, + sit : amet, +}; diff --git a/tests/target/space-before-type-annotation.rs b/tests/target/space-before-type-annotation.rs index 54b9541eaae..0ad06dbb70c 100644 --- a/tests/target/space-before-type-annotation.rs +++ b/tests/target/space-before-type-annotation.rs @@ -9,5 +9,5 @@ struct S { fieldVar : i32, } fn f() { - S { fieldVar : 42 } + S { fieldVar: 42 } } diff --git a/tests/target/space-not-after-type-annotation-colon.rs b/tests/target/space-not-after-type-annotation-colon.rs index 3bdfa57fb73..b07620fb4c1 100644 --- a/tests/target/space-not-after-type-annotation-colon.rs +++ b/tests/target/space-not-after-type-annotation-colon.rs @@ -10,5 +10,5 @@ struct S { fieldVar :i32, } fn f() { - S { fieldVar :42 } + S { fieldVar: 42 } } -- cgit 1.4.1-3-g733a5