diff options
| author | Nick Cameron <nrc@ncameron.org> | 2017-06-06 16:20:16 +1200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-06-06 16:20:16 +1200 |
| commit | 6a9d7dab0d2a1720bdee67148db28b3a29ec3655 (patch) | |
| tree | fd0b1ec19dc74c9a98c3ad3c29d82b90484efc60 /src/expr.rs | |
| parent | 450631ae67728e1e8ac84d4ba8f14637b6b0e603 (diff) | |
| parent | aa4cd311bb07ea25d89096e8fdd5d64b73666c28 (diff) | |
Merge pull request #1637 from est31/master
Add config options for spaces around the colon in struct literal fields
Diffstat (limited to 'src/expr.rs')
| -rw-r--r-- | src/expr.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/expr.rs b/src/expr.rs index d7532ae2243..72c10619ea2 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -2050,18 +2050,18 @@ fn rewrite_struct_lit<'a>(context: &RewriteContext, // FIXME if context.config.struct_lit_style() == Visual, but we run out // of space, we should fall back to BlockIndent. } - -pub fn type_annotation_separator(config: &Config) -> &str { - colon_spaces(config.space_before_type_annotation(), - config.space_after_type_annotation_colon()) +pub fn struct_lit_field_separator(config: &Config) -> &str { + colon_spaces(config.space_before_struct_lit_field_colon(), + config.space_after_struct_lit_field_colon()) } + fn rewrite_field(context: &RewriteContext, field: &ast::Field, shape: Shape) -> Option<String> { let name = &field.ident.node.to_string(); if field.is_shorthand { Some(name.to_string()) } else { - let separator = type_annotation_separator(context.config); + let separator = struct_lit_field_separator(context.config); let overhead = name.len() + separator.len(); let mut expr_shape = try_opt!(shape.sub_width(overhead)); expr_shape.offset += overhead; |
