From f2838595d56124548f403a81715627872a4f93ba Mon Sep 17 00:00:00 2001 From: Seiichi Uchida Date: Sat, 10 Jun 2017 22:20:11 +0900 Subject: [PATCH 1/2] Add visual offset when using struct_lit_style is Visual --- src/lists.rs | 3 ++- tests/target/configs-struct_lit_style-visual.rs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lists.rs b/src/lists.rs index 978d9dbaceb3..ec4427032e59 100644 --- a/src/lists.rs +++ b/src/lists.rs @@ -529,7 +529,8 @@ pub fn struct_lit_shape(shape: Shape, -> Option<(Option, 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()); diff --git a/tests/target/configs-struct_lit_style-visual.rs b/tests/target/configs-struct_lit_style-visual.rs index 685ded59aad6..eb470e1e29c0 100644 --- a/tests/target/configs-struct_lit_style-visual.rs +++ b/tests/target/configs-struct_lit_style-visual.rs @@ -3,5 +3,5 @@ fn main() { let lorem = Lorem { ipsum: dolor, - sit: amet, }; + sit: amet, }; } From 41ca11193d04e703addd6b89fb464101466f00a4 Mon Sep 17 00:00:00 2001 From: Seiichi Uchida Date: Sat, 10 Jun 2017 22:23:09 +0900 Subject: [PATCH 2/2] Fix Configurations.md --- Configurations.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Configurations.md b/Configurations.md index 73e7cb101c7b..82f50dc66727 100644 --- a/Configurations.md +++ b/Configurations.md @@ -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).