Skip to content

Commit 9367b9a

Browse files
author
Veetaha
committed
ra_syntax: add backticks around tokens specimen
1 parent c3117ee commit 9367b9a

File tree

1 file changed

+23
-12
lines changed

1 file changed

+23
-12
lines changed

crates/ra_syntax/src/syntax_error.rs

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ impl SyntaxError {
7171

7272
self
7373
}
74+
75+
pub fn debug_dump(&self, acc: &mut impl fmt::Write) {
76+
writeln!(acc, "error {:?}: {}", self.location(), self.kind()).unwrap();
77+
}
7478
}
7579

7680
impl fmt::Display for SyntaxError {
@@ -122,37 +126,44 @@ impl fmt::Display for SyntaxErrorKind {
122126

123127
impl fmt::Display for TokenizeError {
124128
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
129+
#[rustfmt::skip]
125130
let msg = match self {
126-
TokenizeError::EmptyInt => "Missing digits after integer base prefix",
127-
TokenizeError::EmptyExponent => "Missing digits after the exponent symbol",
131+
TokenizeError::EmptyInt => {
132+
"Missing digits after the integer base prefix"
133+
}
134+
TokenizeError::EmptyExponent => {
135+
"Missing digits after the exponent symbol"
136+
}
128137
TokenizeError::UnterminatedBlockComment => {
129-
"Missing trailing */ symbols to terminate the block comment"
138+
"Missing trailing `*/` symbols to terminate the block comment"
130139
}
131140
TokenizeError::UnterminatedChar => {
132-
"Missing trailing ' symbol to terminate the character literal"
141+
"Missing trailing `'` symbol to terminate the character literal"
133142
}
134143
TokenizeError::UnterminatedByte => {
135-
"Missing trailing ' symbol to terminate the byte literal"
144+
"Missing trailing `'` symbol to terminate the byte literal"
136145
}
137146
TokenizeError::UnterminatedString => {
138-
"Missing trailing \" symbol to terminate the string literal"
147+
"Missing trailing `\"` symbol to terminate the string literal"
139148
}
140149
TokenizeError::UnterminatedByteString => {
141-
"Missing trailing \" symbol to terminate the byte string literal"
150+
"Missing trailing `\"` symbol to terminate the byte string literal"
142151
}
143152
TokenizeError::UnterminatedRawString => {
144-
"Missing trailing \" with # symbols to terminate the raw string literal"
153+
"Missing trailing `\"` with `#` symbols to terminate the raw string literal"
145154
}
146155
TokenizeError::UnterminatedRawByteString => {
147-
"Missing trailing \" with # symbols to terminate the raw byte string literal"
156+
"Missing trailing `\"` with `#` symbols to terminate the raw byte string literal"
148157
}
149158
TokenizeError::UnstartedRawString => {
150-
"Missing \" symbol after # symbols to begin the raw string literal"
159+
"Missing `\"` symbol after `#` symbols to begin the raw string literal"
151160
}
152161
TokenizeError::UnstartedRawByteString => {
153-
"Missing \" symbol after # symbols to begin the raw byte string literal"
162+
"Missing `\"` symbol after `#` symbols to begin the raw byte string literal"
163+
}
164+
TokenizeError::LifetimeStartsWithNumber => {
165+
"Lifetime name cannot start with a number"
154166
}
155-
TokenizeError::LifetimeStartsWithNumber => "Lifetime name cannot start with a number",
156167
};
157168
write!(f, "{}", msg)
158169
}

0 commit comments

Comments
 (0)