aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/validation.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax/src/validation.rs')
-rw-r--r--crates/ra_syntax/src/validation.rs54
1 files changed, 26 insertions, 28 deletions
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 @@
1mod block; 1mod block;
2 2
3use ra_rustc_lexer::unescape; 3use rustc_lexer::unescape;
4 4
5use crate::{ 5use crate::{
6 algo::visit::{visitor_ctx, VisitorCtx}, 6 algo::visit::{visitor_ctx, VisitorCtx},
@@ -32,64 +32,62 @@ pub enum EscapeError {
32 NonAsciiCharInByte, 32 NonAsciiCharInByte,
33} 33}
34 34
35impl From<ra_rustc_lexer::unescape::EscapeError> for EscapeError { 35impl From<rustc_lexer::unescape::EscapeError> for EscapeError {
36 fn from(err: ra_rustc_lexer::unescape::EscapeError) -> Self { 36 fn from(err: rustc_lexer::unescape::EscapeError) -> Self {
37 match err { 37 match err {
38 ra_rustc_lexer::unescape::EscapeError::ZeroChars => EscapeError::ZeroChars, 38 rustc_lexer::unescape::EscapeError::ZeroChars => EscapeError::ZeroChars,
39 ra_rustc_lexer::unescape::EscapeError::MoreThanOneChar => EscapeError::MoreThanOneChar, 39 rustc_lexer::unescape::EscapeError::MoreThanOneChar => EscapeError::MoreThanOneChar,
40 ra_rustc_lexer::unescape::EscapeError::LoneSlash => EscapeError::LoneSlash, 40 rustc_lexer::unescape::EscapeError::LoneSlash => EscapeError::LoneSlash,
41 ra_rustc_lexer::unescape::EscapeError::InvalidEscape => EscapeError::InvalidEscape, 41 rustc_lexer::unescape::EscapeError::InvalidEscape => EscapeError::InvalidEscape,
42 ra_rustc_lexer::unescape::EscapeError::BareCarriageReturn 42 rustc_lexer::unescape::EscapeError::BareCarriageReturn
43 | ra_rustc_lexer::unescape::EscapeError::BareCarriageReturnInRawString => { 43 | rustc_lexer::unescape::EscapeError::BareCarriageReturnInRawString => {
44 EscapeError::BareCarriageReturn 44 EscapeError::BareCarriageReturn
45 } 45 }
46 ra_rustc_lexer::unescape::EscapeError::EscapeOnlyChar => EscapeError::EscapeOnlyChar, 46 rustc_lexer::unescape::EscapeError::EscapeOnlyChar => EscapeError::EscapeOnlyChar,
47 ra_rustc_lexer::unescape::EscapeError::TooShortHexEscape => { 47 rustc_lexer::unescape::EscapeError::TooShortHexEscape => EscapeError::TooShortHexEscape,
48 EscapeError::TooShortHexEscape 48 rustc_lexer::unescape::EscapeError::InvalidCharInHexEscape => {
49 }
50 ra_rustc_lexer::unescape::EscapeError::InvalidCharInHexEscape => {
51 EscapeError::InvalidCharInHexEscape 49 EscapeError::InvalidCharInHexEscape
52 } 50 }
53 ra_rustc_lexer::unescape::EscapeError::OutOfRangeHexEscape => { 51 rustc_lexer::unescape::EscapeError::OutOfRangeHexEscape => {
54 EscapeError::OutOfRangeHexEscape 52 EscapeError::OutOfRangeHexEscape
55 } 53 }
56 ra_rustc_lexer::unescape::EscapeError::NoBraceInUnicodeEscape => { 54 rustc_lexer::unescape::EscapeError::NoBraceInUnicodeEscape => {
57 EscapeError::NoBraceInUnicodeEscape 55 EscapeError::NoBraceInUnicodeEscape
58 } 56 }
59 ra_rustc_lexer::unescape::EscapeError::InvalidCharInUnicodeEscape => { 57 rustc_lexer::unescape::EscapeError::InvalidCharInUnicodeEscape => {
60 EscapeError::InvalidCharInUnicodeEscape 58 EscapeError::InvalidCharInUnicodeEscape
61 } 59 }
62 ra_rustc_lexer::unescape::EscapeError::EmptyUnicodeEscape => { 60 rustc_lexer::unescape::EscapeError::EmptyUnicodeEscape => {
63 EscapeError::EmptyUnicodeEscape 61 EscapeError::EmptyUnicodeEscape
64 } 62 }
65 ra_rustc_lexer::unescape::EscapeError::UnclosedUnicodeEscape => { 63 rustc_lexer::unescape::EscapeError::UnclosedUnicodeEscape => {
66 EscapeError::UnclosedUnicodeEscape 64 EscapeError::UnclosedUnicodeEscape
67 } 65 }
68 ra_rustc_lexer::unescape::EscapeError::LeadingUnderscoreUnicodeEscape => { 66 rustc_lexer::unescape::EscapeError::LeadingUnderscoreUnicodeEscape => {
69 EscapeError::LeadingUnderscoreUnicodeEscape 67 EscapeError::LeadingUnderscoreUnicodeEscape
70 } 68 }
71 ra_rustc_lexer::unescape::EscapeError::OverlongUnicodeEscape => { 69 rustc_lexer::unescape::EscapeError::OverlongUnicodeEscape => {
72 EscapeError::OverlongUnicodeEscape 70 EscapeError::OverlongUnicodeEscape
73 } 71 }
74 ra_rustc_lexer::unescape::EscapeError::LoneSurrogateUnicodeEscape => { 72 rustc_lexer::unescape::EscapeError::LoneSurrogateUnicodeEscape => {
75 EscapeError::LoneSurrogateUnicodeEscape 73 EscapeError::LoneSurrogateUnicodeEscape
76 } 74 }
77 ra_rustc_lexer::unescape::EscapeError::OutOfRangeUnicodeEscape => { 75 rustc_lexer::unescape::EscapeError::OutOfRangeUnicodeEscape => {
78 EscapeError::OutOfRangeUnicodeEscape 76 EscapeError::OutOfRangeUnicodeEscape
79 } 77 }
80 ra_rustc_lexer::unescape::EscapeError::UnicodeEscapeInByte => { 78 rustc_lexer::unescape::EscapeError::UnicodeEscapeInByte => {
81 EscapeError::UnicodeEscapeInByte 79 EscapeError::UnicodeEscapeInByte
82 } 80 }
83 ra_rustc_lexer::unescape::EscapeError::NonAsciiCharInByte 81 rustc_lexer::unescape::EscapeError::NonAsciiCharInByte
84 | ra_rustc_lexer::unescape::EscapeError::NonAsciiCharInByteString => { 82 | rustc_lexer::unescape::EscapeError::NonAsciiCharInByteString => {
85 EscapeError::NonAsciiCharInByte 83 EscapeError::NonAsciiCharInByte
86 } 84 }
87 } 85 }
88 } 86 }
89} 87}
90 88
91impl From<ra_rustc_lexer::unescape::EscapeError> for SyntaxErrorKind { 89impl From<rustc_lexer::unescape::EscapeError> for SyntaxErrorKind {
92 fn from(err: ra_rustc_lexer::unescape::EscapeError) -> Self { 90 fn from(err: rustc_lexer::unescape::EscapeError) -> Self {
93 SyntaxErrorKind::EscapeError(err.into()) 91 SyntaxErrorKind::EscapeError(err.into())
94 } 92 }
95} 93}