about summary refs log tree commit diff
path: root/compiler/rustc_ast/src/util/literal.rs
diff options
context:
space:
mode:
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>2022-09-12 15:21:30 +0530
committerGitHub <noreply@github.com>2022-09-12 15:21:30 +0530
commit93177758fccdaac08d606348f79b20e9cd9df022 (patch)
tree2d40e1231d79e875258f1414f30b045d083f48c3 /compiler/rustc_ast/src/util/literal.rs
parent413703201c59f25a5a2fded13d7ee4b4be4e8545 (diff)
parenta297631bdcc7742b55cf5961fcbc505e91217c7d (diff)
downloadrust-93177758fccdaac08d606348f79b20e9cd9df022.tar.gz
rust-93177758fccdaac08d606348f79b20e9cd9df022.zip
Rollup merge of #100767 - kadiwa4:escape_ascii, r=jackh726
Remove manual <[u8]>::escape_ascii

`@rustbot` label: +C-cleanup
Diffstat (limited to 'compiler/rustc_ast/src/util/literal.rs')
-rw-r--r--compiler/rustc_ast/src/util/literal.rs7
1 files changed, 1 insertions, 6 deletions
diff --git a/compiler/rustc_ast/src/util/literal.rs b/compiler/rustc_ast/src/util/literal.rs
index 6a1578498e6..536b385606c 100644
--- a/compiler/rustc_ast/src/util/literal.rs
+++ b/compiler/rustc_ast/src/util/literal.rs
@@ -163,12 +163,7 @@ impl LitKind {
             }
             LitKind::Str(symbol, ast::StrStyle::Raw(n)) => (token::StrRaw(n), symbol, None),
             LitKind::ByteStr(ref bytes) => {
-                let string = bytes
-                    .iter()
-                    .cloned()
-                    .flat_map(ascii::escape_default)
-                    .map(Into::<char>::into)
-                    .collect::<String>();
+                let string = bytes.escape_ascii().to_string();
                 (token::ByteStr, Symbol::intern(&string), None)
             }
             LitKind::Byte(byte) => {