Merge pull request #199 from ineol/raw_strings

Don't format raw strings
This commit is contained in:
Marcus Klaas de Vries 2015-08-22 21:26:50 +02:00
commit 3c6f623385
3 changed files with 11 additions and 1 deletions

View File

@ -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(),

View File

@ -17,5 +17,10 @@ fn main() -> &'static str {
let really_long_variable_name = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
let raw_string = r#"Do
not
remove
formatting"#;
"stuff"
}

View File

@ -19,5 +19,10 @@ fn main() -> &'static str {
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
let raw_string = r#"Do
not
remove
formatting"#;
"stuff"
}