diff options
Diffstat (limited to 'crates/ra_syntax/src/validation/char.rs')
-rw-r--r-- | crates/ra_syntax/src/validation/char.rs | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/crates/ra_syntax/src/validation/char.rs b/crates/ra_syntax/src/validation/char.rs index e3ac5836b..012594db3 100644 --- a/crates/ra_syntax/src/validation/char.rs +++ b/crates/ra_syntax/src/validation/char.rs | |||
@@ -31,10 +31,7 @@ pub(super) fn validate_char_node(node: &ast::Char, errors: &mut Vec<SyntaxError> | |||
31 | } | 31 | } |
32 | 32 | ||
33 | if let Some(range) = components.suffix { | 33 | if let Some(range) = components.suffix { |
34 | errors.push(SyntaxError::new( | 34 | errors.push(SyntaxError::new(InvalidSuffix, range + literal_range.start())); |
35 | InvalidSuffix, | ||
36 | range + literal_range.start(), | ||
37 | )); | ||
38 | } | 35 | } |
39 | 36 | ||
40 | if len == 0 { | 37 | if len == 0 { |
@@ -184,12 +181,7 @@ mod test { | |||
184 | 181 | ||
185 | fn assert_valid_char(literal: &str) { | 182 | fn assert_valid_char(literal: &str) { |
186 | let file = build_file(literal); | 183 | let file = build_file(literal); |
187 | assert!( | 184 | assert!(file.errors().len() == 0, "Errors for literal '{}': {:?}", literal, file.errors()); |
188 | file.errors().len() == 0, | ||
189 | "Errors for literal '{}': {:?}", | ||
190 | literal, | ||
191 | file.errors() | ||
192 | ); | ||
193 | } | 185 | } |
194 | 186 | ||
195 | fn assert_invalid_char(literal: &str) { | 187 | fn assert_invalid_char(literal: &str) { |
@@ -258,13 +250,7 @@ mod test { | |||
258 | 250 | ||
259 | #[test] | 251 | #[test] |
260 | fn test_valid_unicode_escape() { | 252 | fn test_valid_unicode_escape() { |
261 | let valid = [ | 253 | let valid = [r"\u{FF}", r"\u{0}", r"\u{F}", r"\u{10FFFF}", r"\u{1_0__FF___FF_____}"]; |
262 | r"\u{FF}", | ||
263 | r"\u{0}", | ||
264 | r"\u{F}", | ||
265 | r"\u{10FFFF}", | ||
266 | r"\u{1_0__FF___FF_____}", | ||
267 | ]; | ||
268 | for c in &valid { | 254 | for c in &valid { |
269 | assert_valid_char(c); | 255 | assert_valid_char(c); |
270 | } | 256 | } |