From 5047091f087cc5410750898e24ccf337e79e4afb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Stefanesco?= Date: Fri, 21 Aug 2015 19:13:46 +0200 Subject: [PATCH 1/2] Don't format raw strings --- src/expr.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/expr.rs b/src/expr.rs index b8f94230c23..c849d58efae 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -28,7 +28,7 @@ impl Rewrite for ast::Expr { match self.node { ast::Expr_::ExprLit(ref l) => { match l.node { - ast::Lit_::LitStr(ref is, _) => { + ast::Lit_::LitStr(ref is, ast::StrStyle::CookedStr) => { rewrite_string_lit(context, &is, l.span, width, offset) } _ => context.codemap.span_to_snippet(self.span).ok(), From 8b785683884ffcfc8a4fd19741db3286a23e4cd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Stefanesco?= Date: Sat, 22 Aug 2015 21:20:31 +0200 Subject: [PATCH 2/2] Add test for raw strings --- tests/source/string-lit.rs | 5 +++++ tests/target/string-lit.rs | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/tests/source/string-lit.rs b/tests/source/string-lit.rs index 1e2544c7b3e..0c4a371df17 100644 --- a/tests/source/string-lit.rs +++ b/tests/source/string-lit.rs @@ -17,5 +17,10 @@ fn main() -> &'static str { let really_long_variable_name = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; + let raw_string = r#"Do +not +remove +formatting"#; + "stuff" } diff --git a/tests/target/string-lit.rs b/tests/target/string-lit.rs index ad727552d45..2ccb3480d6f 100644 --- a/tests/target/string-lit.rs +++ b/tests/target/string-lit.rs @@ -19,5 +19,10 @@ fn main() -> &'static str { AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; + let raw_string = r#"Do +not +remove +formatting"#; + "stuff" }