]> git.lizzy.rs Git - rust.git/commitdiff
Use visual indent only when rewriting string literal
authortopecongiro <seuchida@gmail.com>
Tue, 31 Oct 2017 06:03:46 +0000 (15:03 +0900)
committertopecongiro <seuchida@gmail.com>
Tue, 31 Oct 2017 06:03:46 +0000 (15:03 +0900)
src/expr.rs
src/string.rs

index 212f05b52b82ffb5fff76c05b0c43d9c646631b6..193a5c847bbe35b5ae2b5bb225bfa0dd31724cda 100644 (file)
@@ -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(
index 9812b8af6110c42f340f19f6bcdda5e340dd440d..c3f1c5faf1e36e3ea5a5965d45abcc725e0120a4 100644 (file)
@@ -50,7 +50,7 @@ pub fn rewrite_string<'a>(orig: &str, fmt: &StringFormat<'a>) -> Option<String>
     let stripped_str = re.replace_all(orig, "$1");
 
     let graphemes = UnicodeSegmentation::graphemes(&*stripped_str, false).collect::<Vec<&str>>();
-    let shape = fmt.shape.visual_indent(0);
+    let shape = fmt.shape;
     let indent = shape.indent.to_string(fmt.config);
     let punctuation = ":,;.";