aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/validation/byte.rs
diff options
context:
space:
mode:
authorAdolfo OchagavĂ­a <[email protected]>2018-11-11 20:00:31 +0000
committerAdolfo OchagavĂ­a <[email protected]>2018-11-11 20:00:31 +0000
commitc96bfe7e2d4465653fe6b0eff053f0dfb48313fa (patch)
tree93c56d8301131a01de13b73010f615291eb1d6d4 /crates/ra_syntax/src/validation/byte.rs
parent30cd4d5acb7dfd40cea264a926d1c89f0c3522c3 (diff)
Split string lexing and run rustfmt
Diffstat (limited to 'crates/ra_syntax/src/validation/byte.rs')
-rw-r--r--crates/ra_syntax/src/validation/byte.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/crates/ra_syntax/src/validation/byte.rs b/crates/ra_syntax/src/validation/byte.rs
index 7baf3c1d7..43c0d7edd 100644
--- a/crates/ra_syntax/src/validation/byte.rs
+++ b/crates/ra_syntax/src/validation/byte.rs
@@ -48,7 +48,10 @@ pub(super) fn validate_byte_component(
48 AsciiCodeEscape => validate_byte_code_escape(text, range, errors), 48 AsciiCodeEscape => validate_byte_code_escape(text, range, errors),
49 UnicodeEscape => errors.push(SyntaxError::new(UnicodeEscapeForbidden, range)), 49 UnicodeEscape => errors.push(SyntaxError::new(UnicodeEscapeForbidden, range)),
50 CodePoint => { 50 CodePoint => {
51 let c = text.chars().next().expect("Code points should be one character long"); 51 let c = text
52 .chars()
53 .next()
54 .expect("Code points should be one character long");
52 55
53 // These bytes must always be escaped 56 // These bytes must always be escaped
54 if c == '\t' || c == '\r' || c == '\n' { 57 if c == '\t' || c == '\r' || c == '\n' {
@@ -148,9 +151,7 @@ mod test {
148 151
149 #[test] 152 #[test]
150 fn test_valid_byte_escape() { 153 fn test_valid_byte_escape() {
151 let valid = [ 154 let valid = [r"\'", "\"", "\\\\", "\\\"", r"\n", r"\r", r"\t", r"\0"];
152 r"\'", "\"", "\\\\", "\\\"", r"\n", r"\r", r"\t", r"\0",
153 ];
154 for c in &valid { 155 for c in &valid {
155 assert_valid_byte(c); 156 assert_valid_byte(c);
156 } 157 }