From deba1fedfaac49804896d238e16aeb32ea8a2d97 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 20 Aug 2019 19:16:57 +0300 Subject: :arrow_up: rustc_lexer --- crates/ra_syntax/src/validation.rs | 54 ++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 28 deletions(-) (limited to 'crates/ra_syntax/src/validation.rs') diff --git a/crates/ra_syntax/src/validation.rs b/crates/ra_syntax/src/validation.rs index 2bb3c0a03..a8c789e0c 100644 --- a/crates/ra_syntax/src/validation.rs +++ b/crates/ra_syntax/src/validation.rs @@ -1,6 +1,6 @@ mod block; -use ra_rustc_lexer::unescape; +use rustc_lexer::unescape; use crate::{ algo::visit::{visitor_ctx, VisitorCtx}, @@ -32,64 +32,62 @@ pub enum EscapeError { NonAsciiCharInByte, } -impl From for EscapeError { - fn from(err: ra_rustc_lexer::unescape::EscapeError) -> Self { +impl From for EscapeError { + fn from(err: rustc_lexer::unescape::EscapeError) -> Self { match err { - ra_rustc_lexer::unescape::EscapeError::ZeroChars => EscapeError::ZeroChars, - ra_rustc_lexer::unescape::EscapeError::MoreThanOneChar => EscapeError::MoreThanOneChar, - ra_rustc_lexer::unescape::EscapeError::LoneSlash => EscapeError::LoneSlash, - ra_rustc_lexer::unescape::EscapeError::InvalidEscape => EscapeError::InvalidEscape, - ra_rustc_lexer::unescape::EscapeError::BareCarriageReturn - | ra_rustc_lexer::unescape::EscapeError::BareCarriageReturnInRawString => { + rustc_lexer::unescape::EscapeError::ZeroChars => EscapeError::ZeroChars, + rustc_lexer::unescape::EscapeError::MoreThanOneChar => EscapeError::MoreThanOneChar, + rustc_lexer::unescape::EscapeError::LoneSlash => EscapeError::LoneSlash, + rustc_lexer::unescape::EscapeError::InvalidEscape => EscapeError::InvalidEscape, + rustc_lexer::unescape::EscapeError::BareCarriageReturn + | rustc_lexer::unescape::EscapeError::BareCarriageReturnInRawString => { EscapeError::BareCarriageReturn } - ra_rustc_lexer::unescape::EscapeError::EscapeOnlyChar => EscapeError::EscapeOnlyChar, - ra_rustc_lexer::unescape::EscapeError::TooShortHexEscape => { - EscapeError::TooShortHexEscape - } - ra_rustc_lexer::unescape::EscapeError::InvalidCharInHexEscape => { + rustc_lexer::unescape::EscapeError::EscapeOnlyChar => EscapeError::EscapeOnlyChar, + rustc_lexer::unescape::EscapeError::TooShortHexEscape => EscapeError::TooShortHexEscape, + rustc_lexer::unescape::EscapeError::InvalidCharInHexEscape => { EscapeError::InvalidCharInHexEscape } - ra_rustc_lexer::unescape::EscapeError::OutOfRangeHexEscape => { + rustc_lexer::unescape::EscapeError::OutOfRangeHexEscape => { EscapeError::OutOfRangeHexEscape } - ra_rustc_lexer::unescape::EscapeError::NoBraceInUnicodeEscape => { + rustc_lexer::unescape::EscapeError::NoBraceInUnicodeEscape => { EscapeError::NoBraceInUnicodeEscape } - ra_rustc_lexer::unescape::EscapeError::InvalidCharInUnicodeEscape => { + rustc_lexer::unescape::EscapeError::InvalidCharInUnicodeEscape => { EscapeError::InvalidCharInUnicodeEscape } - ra_rustc_lexer::unescape::EscapeError::EmptyUnicodeEscape => { + rustc_lexer::unescape::EscapeError::EmptyUnicodeEscape => { EscapeError::EmptyUnicodeEscape } - ra_rustc_lexer::unescape::EscapeError::UnclosedUnicodeEscape => { + rustc_lexer::unescape::EscapeError::UnclosedUnicodeEscape => { EscapeError::UnclosedUnicodeEscape } - ra_rustc_lexer::unescape::EscapeError::LeadingUnderscoreUnicodeEscape => { + rustc_lexer::unescape::EscapeError::LeadingUnderscoreUnicodeEscape => { EscapeError::LeadingUnderscoreUnicodeEscape } - ra_rustc_lexer::unescape::EscapeError::OverlongUnicodeEscape => { + rustc_lexer::unescape::EscapeError::OverlongUnicodeEscape => { EscapeError::OverlongUnicodeEscape } - ra_rustc_lexer::unescape::EscapeError::LoneSurrogateUnicodeEscape => { + rustc_lexer::unescape::EscapeError::LoneSurrogateUnicodeEscape => { EscapeError::LoneSurrogateUnicodeEscape } - ra_rustc_lexer::unescape::EscapeError::OutOfRangeUnicodeEscape => { + rustc_lexer::unescape::EscapeError::OutOfRangeUnicodeEscape => { EscapeError::OutOfRangeUnicodeEscape } - ra_rustc_lexer::unescape::EscapeError::UnicodeEscapeInByte => { + rustc_lexer::unescape::EscapeError::UnicodeEscapeInByte => { EscapeError::UnicodeEscapeInByte } - ra_rustc_lexer::unescape::EscapeError::NonAsciiCharInByte - | ra_rustc_lexer::unescape::EscapeError::NonAsciiCharInByteString => { + rustc_lexer::unescape::EscapeError::NonAsciiCharInByte + | rustc_lexer::unescape::EscapeError::NonAsciiCharInByteString => { EscapeError::NonAsciiCharInByte } } } } -impl From for SyntaxErrorKind { - fn from(err: ra_rustc_lexer::unescape::EscapeError) -> Self { +impl From for SyntaxErrorKind { + fn from(err: rustc_lexer::unescape::EscapeError) -> Self { SyntaxErrorKind::EscapeError(err.into()) } } -- cgit v1.2.3