mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-21 17:52:12 +03:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user