Skip to content

Commit 8da6698

Browse files
committed
Don't escape_default all non-ascii text
Using escape_debug instead of escape_default matches the behavior of libproc_macro for: println!("{:#?}", "///こんにちは世界".parse::<TokenStream>().unwrap()); Before: "\u{3053}\u{3093}\u{306b}\u{3061}\u{306f}\u{4e16}\u{754c}" After: "こんにちは世界"
1 parent 903a972 commit 8da6698

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/fallback.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -754,10 +754,10 @@ impl Literal {
754754
text.push('"');
755755
for c in t.chars() {
756756
if c == '\'' {
757-
// escape_default turns this into "\'" which is unnecessary.
757+
// escape_debug turns this into "\'" which is unnecessary.
758758
text.push(c);
759759
} else {
760-
text.extend(c.escape_default());
760+
text.extend(c.escape_debug());
761761
}
762762
}
763763
text.push('"');
@@ -768,10 +768,10 @@ impl Literal {
768768
let mut text = String::new();
769769
text.push('\'');
770770
if t == '"' {
771-
// escape_default turns this into '\"' which is unnecessary.
771+
// escape_debug turns this into '\"' which is unnecessary.
772772
text.push(t);
773773
} else {
774-
text.extend(t.escape_default());
774+
text.extend(t.escape_debug());
775775
}
776776
text.push('\'');
777777
Literal::_new(text)

0 commit comments

Comments
 (0)