From 7e99893e25c900ceb8b61c6c69e8a46d3e604c1d Mon Sep 17 00:00:00 2001 From: topecongiro Date: Tue, 31 Oct 2017 15:03:46 +0900 Subject: [PATCH] Use visual indent only when rewriting string literal --- src/expr.rs | 2 +- src/string.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/expr.rs b/src/expr.rs index 212f05b52b82..193a5c847bbe 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -1955,7 +1955,7 @@ fn rewrite_string_lit(context: &RewriteContext, span: Span, shape: Shape) -> Opt // Remove the quote characters. let str_lit = &string_lit[1..string_lit.len() - 1]; - rewrite_string(str_lit, &StringFormat::new(shape, context.config)) + rewrite_string(str_lit, &StringFormat::new(shape.visual_indent(0), context.config)) } fn string_requires_rewrite( diff --git a/src/string.rs b/src/string.rs index 9812b8af6110..c3f1c5faf1e3 100644 --- a/src/string.rs +++ b/src/string.rs @@ -50,7 +50,7 @@ pub fn rewrite_string<'a>(orig: &str, fmt: &StringFormat<'a>) -> Option let stripped_str = re.replace_all(orig, "$1"); let graphemes = UnicodeSegmentation::graphemes(&*stripped_str, false).collect::>(); - let shape = fmt.shape.visual_indent(0); + let shape = fmt.shape; let indent = shape.indent.to_string(fmt.config); let punctuation = ":,;.";