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:
parent
d04ab9e5ba
commit
aa4cd311bb
14 changed files with 121 additions and 9 deletions
|
|
@ -0,0 +1,6 @@
|
|||
// rustfmt-space_after_struct_lit_field_colon: false
|
||||
|
||||
const LOREM: Lorem = Lorem {
|
||||
ipsum:dolor,
|
||||
sit : amet,
|
||||
};
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
// rustfmt-space_after_struct_lit_field_colon: true
|
||||
|
||||
const LOREM: Lorem = Lorem {
|
||||
ipsum:dolor,
|
||||
sit : amet,
|
||||
};
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
// rustfmt-space_before_struct_lit_field_colon: false
|
||||
|
||||
const LOREM: Lorem = Lorem {
|
||||
ipsum:dolor,
|
||||
sit : amet,
|
||||
};
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
// rustfmt-space_before_struct_lit_field_colon: true
|
||||
|
||||
const LOREM: Lorem = Lorem {
|
||||
ipsum:dolor,
|
||||
sit : amet,
|
||||
};
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
// rustfmt-space_after_struct_lit_field_colon: false
|
||||
|
||||
const LOREM: Lorem = Lorem {
|
||||
ipsum:dolor,
|
||||
sit:amet,
|
||||
};
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
// rustfmt-space_after_struct_lit_field_colon: true
|
||||
|
||||
const LOREM: Lorem = Lorem {
|
||||
ipsum: dolor,
|
||||
sit: amet,
|
||||
};
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
// rustfmt-space_before_struct_lit_field_colon: false
|
||||
|
||||
const LOREM: Lorem = Lorem {
|
||||
ipsum: dolor,
|
||||
sit: amet,
|
||||
};
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
// rustfmt-space_before_struct_lit_field_colon: true
|
||||
|
||||
const LOREM: Lorem = Lorem {
|
||||
ipsum : dolor,
|
||||
sit : amet,
|
||||
};
|
||||
|
|
@ -9,5 +9,5 @@ struct S {
|
|||
fieldVar : i32,
|
||||
}
|
||||
fn f() {
|
||||
S { fieldVar : 42 }
|
||||
S { fieldVar: 42 }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,5 +10,5 @@ struct S {
|
|||
fieldVar :i32,
|
||||
}
|
||||
fn f() {
|
||||
S { fieldVar :42 }
|
||||
S { fieldVar: 42 }
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue