Merge pull request #1649 from topecongiro/issue-1648

Add offset to struct literal fields when `struct_lit_style` is `"Visual"`
This commit is contained in:
Nick Cameron 2017-06-12 10:39:28 +12:00 committed by GitHub
commit 272b0b6f49
3 changed files with 4 additions and 3 deletions

View file

@ -1442,7 +1442,7 @@ let lorem = Lorem {
```rust
let lorem = Lorem { ipsum: dolor,
sit: amet, };
sit: amet, };
```
See also: [`struct_lit_multiline_style`](#struct_lit_multiline_style), [`struct_lit_style`](#struct_lit_style).

View file

@ -529,7 +529,8 @@ pub fn struct_lit_shape(shape: Shape,
-> Option<(Option<Shape>, Shape)> {
let v_shape = match context.config.struct_lit_style() {
IndentStyle::Visual => {
try_opt!(try_opt!(shape.shrink_left(prefix_width)).sub_width(suffix_width))
try_opt!(try_opt!(shape.visual_indent(0).shrink_left(prefix_width))
.sub_width(suffix_width))
}
IndentStyle::Block => {
let shape = shape.block_indent(context.config.tab_spaces());

View file

@ -3,5 +3,5 @@
fn main() {
let lorem = Lorem { ipsum: dolor,
sit: amet, };
sit: amet, };
}