about summary refs log tree commit diff
path: root/src/libsyntax/attr.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsyntax/attr.rs')
-rw-r--r--src/libsyntax/attr.rs5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs
index 13f8bb9a318..b5461d61dd4 100644
--- a/src/libsyntax/attr.rs
+++ b/src/libsyntax/attr.rs
@@ -1252,10 +1252,7 @@ impl LitKind {
 
         match *self {
             LitKind::Str(string, ast::StrStyle::Cooked) => {
-                let mut escaped = String::new();
-                for ch in string.as_str().chars() {
-                    escaped.extend(ch.escape_unicode());
-                }
+                let escaped = string.as_str().escape_default();
                 Token::Literal(token::Lit::Str_(Symbol::intern(&escaped)), None)
             }
             LitKind::Str(string, ast::StrStyle::Raw(n)) => {