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.
This commit is contained in:
est31
2017-06-06 03:11:17 +02:00
parent d04ab9e5ba
commit aa4cd311bb
14 changed files with 121 additions and 9 deletions
+54
View File
@@ -1123,6 +1123,33 @@ fn lorem<T: Eq>(t: T) {
See also: [`space_before_bound`](#space_before_bound).
## `space_after_struct_lit_field_colon`
Leave a space after the colon in a struct literal field
- **Default value**: `true`
- **Possible values**: `true`, `false`
#### `false`:
```rust
let lorem = Lorem {
ipsum:dolor,
sit:amet,
};
```
#### `true`:
```rust
let lorem = Lorem {
ipsum: dolor,
sit: amet,
};
```
See also: [`space_before_struct_lit_field_colon`](#space_before_struct_lit_field_colon).
## `space_after_type_annotation_colon`
Leave a space after the colon in a type annotation
@@ -1173,6 +1200,33 @@ fn lorem<T : Eq>(t: T) {
See also: [`space_after_bound_colon`](#space_after_bound_colon).
## `space_before_struct_lit_field_colon`
Leave a space before the colon in a struct literal field
- **Default value**: `true`
- **Possible values**: `true`, `false`
#### `false`:
```rust
let lorem = Lorem {
ipsum: dolor,
sit: amet,
};
```
#### `true`:
```rust
let lorem = Lorem {
ipsum : dolor,
sit : amet,
};
```
See also: [`space_after_struct_lit_field_colon`](#space_after_struct_lit_field_colon).
## `space_before_type_annotation`
Leave a space before the colon in a type annotation