Rollup merge of #45101 - lfairy:proc-macro-string-escape, r=jseyfried

Make the result of `Literal::string()` more readable

Closes #45076
This commit is contained in:
kennytm 2017-10-10 20:08:25 +08:00
commit bedce1e0a6
No known key found for this signature in database
GPG Key ID: FEF6C8051D0E013C

View File

@ -488,7 +488,7 @@ impl Literal {
pub fn string(string: &str) -> Literal {
let mut escaped = String::new();
for ch in string.chars() {
escaped.extend(ch.escape_unicode());
escaped.extend(ch.escape_debug());
}
Literal(token::Literal(token::Lit::Str_(Symbol::intern(&escaped)), None))
}