mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-11 04:38:49 +00:00
Rollup merge of #103919 - nnethercote:unescaping-cleanups, r=matklad
Unescaping cleanups Some code improvements, and some error message improvements. Best reviewed one commit at a time. r? ````@matklad````
This commit is contained in:
commit
eed614fed5
1 changed files with 2 additions and 4 deletions
|
@ -5,9 +5,7 @@
|
||||||
mod block;
|
mod block;
|
||||||
|
|
||||||
use rowan::Direction;
|
use rowan::Direction;
|
||||||
use rustc_lexer::unescape::{
|
use rustc_lexer::unescape::{self, unescape_byte, unescape_char, unescape_literal, Mode};
|
||||||
self, unescape_byte, unescape_byte_literal, unescape_char, unescape_literal, Mode,
|
|
||||||
};
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
algo,
|
algo,
|
||||||
|
@ -143,7 +141,7 @@ fn validate_literal(literal: ast::Literal, acc: &mut Vec<SyntaxError>) {
|
||||||
ast::LiteralKind::ByteString(s) => {
|
ast::LiteralKind::ByteString(s) => {
|
||||||
if !s.is_raw() {
|
if !s.is_raw() {
|
||||||
if let Some(without_quotes) = unquote(text, 2, '"') {
|
if let Some(without_quotes) = unquote(text, 2, '"') {
|
||||||
unescape_byte_literal(without_quotes, Mode::ByteStr, &mut |range, char| {
|
unescape_literal(without_quotes, Mode::ByteStr, &mut |range, char| {
|
||||||
if let Err(err) = char {
|
if let Err(err) = char {
|
||||||
push_err(2, (range.start, err));
|
push_err(2, (range.start, err));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue