aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/validation/byte_string.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax/src/validation/byte_string.rs')
-rw-r--r--crates/ra_syntax/src/validation/byte_string.rs13
1 files changed, 10 insertions, 3 deletions
diff --git a/crates/ra_syntax/src/validation/byte_string.rs b/crates/ra_syntax/src/validation/byte_string.rs
index 7b830e97c..f7a4fb156 100644
--- a/crates/ra_syntax/src/validation/byte_string.rs
+++ b/crates/ra_syntax/src/validation/byte_string.rs
@@ -17,21 +17,28 @@ pub(crate) fn validate_byte_string_node(node: ast::ByteString, errors: &mut Vec<
17 let range = component.range + literal_range.start(); 17 let range = component.range + literal_range.start();
18 18
19 match component.kind { 19 match component.kind {
20 StringComponentKind::Char(kind) => { 20 StringComponentKind::IgnoreNewline => { /* always valid */ }
21 _ => {
21 // Chars must escape \t, \n and \r codepoints, but strings don't 22 // Chars must escape \t, \n and \r codepoints, but strings don't
22 let text = &literal_text[component.range]; 23 let text = &literal_text[component.range];
23 match text { 24 match text {
24 "\t" | "\n" | "\r" => { /* always valid */ } 25 "\t" | "\n" | "\r" => { /* always valid */ }
25 _ => byte::validate_byte_component(text, kind, range, errors), 26 _ => byte::validate_byte_component(text, component.kind, range, errors),
26 } 27 }
27 } 28 }
28 StringComponentKind::IgnoreNewline => { /* always valid */ }
29 } 29 }
30 } 30 }
31 31
32 if !components.has_closing_quote { 32 if !components.has_closing_quote {
33 errors.push(SyntaxError::new(UnclosedString, literal_range)); 33 errors.push(SyntaxError::new(UnclosedString, literal_range));
34 } 34 }
35
36 if let Some(range) = components.suffix {
37 errors.push(SyntaxError::new(
38 InvalidSuffix,
39 range + literal_range.start(),
40 ));
41 }
35} 42}
36 43
37#[cfg(test)] 44#[cfg(test)]