about summary refs log tree commit diff
path: root/compiler/rustc_parse_format/src
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2025-04-04 14:44:45 +0200
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2025-04-04 14:44:45 +0200
commitaff2bc7a8815b89dd8dccf2564f5178118c1a3ec (patch)
treead2d6870dec23c0f56d0ed0f22ec38353da899d3 /compiler/rustc_parse_format/src
parenta4166dabaae56ab0d35a7825c3e7008778eacf34 (diff)
downloadrust-aff2bc7a8815b89dd8dccf2564f5178118c1a3ec.tar.gz
rust-aff2bc7a8815b89dd8dccf2564f5178118c1a3ec.zip
Replace `rustc_lexer/unescape` with `rustc-literal-escaper` crate
Diffstat (limited to 'compiler/rustc_parse_format/src')
-rw-r--r--compiler/rustc_parse_format/src/lib.rs10
1 files changed, 4 insertions, 6 deletions
diff --git a/compiler/rustc_parse_format/src/lib.rs b/compiler/rustc_parse_format/src/lib.rs
index 97931742985..c59e6cb5c33 100644
--- a/compiler/rustc_parse_format/src/lib.rs
+++ b/compiler/rustc_parse_format/src/lib.rs
@@ -18,7 +18,7 @@
 pub use Alignment::*;
 pub use Count::*;
 pub use Position::*;
-use rustc_lexer::unescape;
+use rustc_literal_escaper::{Mode, unescape_unicode};
 
 // Note: copied from rustc_span
 /// Range inside of a `Span` used for diagnostics when we only have access to relative positions.
@@ -1094,11 +1094,9 @@ fn find_width_map_from_snippet(
 fn unescape_string(string: &str) -> Option<String> {
     let mut buf = String::new();
     let mut ok = true;
-    unescape::unescape_unicode(string, unescape::Mode::Str, &mut |_, unescaped_char| {
-        match unescaped_char {
-            Ok(c) => buf.push(c),
-            Err(_) => ok = false,
-        }
+    unescape_unicode(string, Mode::Str, &mut |_, unescaped_char| match unescaped_char {
+        Ok(c) => buf.push(c),
+        Err(_) => ok = false,
     });
 
     ok.then_some(buf)