aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/validation/string.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax/src/validation/string.rs')
-rw-r--r--crates/ra_syntax/src/validation/string.rs20
1 files changed, 3 insertions, 17 deletions
diff --git a/crates/ra_syntax/src/validation/string.rs b/crates/ra_syntax/src/validation/string.rs
index 365fe8d2d..4fd7fffdf 100644
--- a/crates/ra_syntax/src/validation/string.rs
+++ b/crates/ra_syntax/src/validation/string.rs
@@ -29,10 +29,7 @@ pub(crate) fn validate_string_node(node: &ast::String, errors: &mut Vec<SyntaxEr
29 } 29 }
30 30
31 if let Some(range) = components.suffix { 31 if let Some(range) = components.suffix {
32 errors.push(SyntaxError::new( 32 errors.push(SyntaxError::new(InvalidSuffix, range + literal_range.start()));
33 InvalidSuffix,
34 range + literal_range.start(),
35 ));
36 } 33 }
37} 34}
38 35
@@ -48,12 +45,7 @@ mod test {
48 45
49 fn assert_valid_str(literal: &str) { 46 fn assert_valid_str(literal: &str) {
50 let file = build_file(literal); 47 let file = build_file(literal);
51 assert!( 48 assert!(file.errors().len() == 0, "Errors for literal '{}': {:?}", literal, file.errors());
52 file.errors().len() == 0,
53 "Errors for literal '{}': {:?}",
54 literal,
55 file.errors()
56 );
57 } 49 }
58 50
59 fn assert_invalid_str(literal: &str) { 51 fn assert_invalid_str(literal: &str) {
@@ -121,13 +113,7 @@ mod test {
121 113
122 #[test] 114 #[test]
123 fn test_valid_unicode_escape() { 115 fn test_valid_unicode_escape() {
124 let valid = [ 116 let valid = [r"\u{FF}", r"\u{0}", r"\u{F}", r"\u{10FFFF}", r"\u{1_0__FF___FF_____}"];
125 r"\u{FF}",
126 r"\u{0}",
127 r"\u{F}",
128 r"\u{10FFFF}",
129 r"\u{1_0__FF___FF_____}",
130 ];
131 for c in &valid { 117 for c in &valid {
132 assert_valid_str(c); 118 assert_valid_str(c);
133 } 119 }