Auto merge of #140999 - hkBst:update-escaper, r=nnethercote
update to literal-escaper 0.0.4 for better API without `unreachable` and faster string parsing This is the replacement for just the part of https://github.com/rust-lang/rust/pull/138163 dealing with the changed API of unescape functionality, since that got moved into its own crate. <del>This uses an unpublished version of literal-escaper (https://github.com/rust-lang/literal-escaper/pull/8).</del> r? `@nnethercote`
This commit is contained in:
commit
4a4d67227e
1 changed files with 2 additions and 1 deletions
|
|
@ -2,6 +2,7 @@ use crate::utils::{
|
|||
ErrAction, File, FileUpdater, RustSearcher, Token, UpdateMode, UpdateStatus, expect_action, update_text_region_fn,
|
||||
};
|
||||
use itertools::Itertools;
|
||||
use rustc_lexer::{LiteralKind, TokenKind, tokenize};
|
||||
use std::collections::HashSet;
|
||||
use std::fmt::Write;
|
||||
use std::ops::Range;
|
||||
|
|
@ -342,7 +343,7 @@ fn parse_str_lit(s: &str) -> String {
|
|||
.and_then(|s| s.strip_suffix('"'))
|
||||
.unwrap_or_else(|| panic!("expected quoted string, found `{s}`"));
|
||||
let mut res = String::with_capacity(s.len());
|
||||
rustc_literal_escaper::unescape_unicode(s, mode, &mut |_, ch| {
|
||||
rustc_literal_escaper::unescape_str(s, |range, ch| {
|
||||
if let Ok(ch) = ch {
|
||||
res.push(ch);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue