aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/validation
diff options
context:
space:
mode:
authorDJMcNab <[email protected]>2019-01-01 11:10:08 +0000
committerDJMcNab <[email protected]>2019-01-01 11:10:08 +0000
commit0fd87cbc478427296f2ca81c177e32bdb41aa133 (patch)
treee5b82bd4e6e6ddd258f503e99afd14ffb8a6d63e /crates/ra_syntax/src/validation
parent72ab6f772736f35c53c738735b0c0b4b3f360a20 (diff)
Use an else if
Diffstat (limited to 'crates/ra_syntax/src/validation')
-rw-r--r--crates/ra_syntax/src/validation/char.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/crates/ra_syntax/src/validation/char.rs b/crates/ra_syntax/src/validation/char.rs
index 3b1b91230..1d6fe8837 100644
--- a/crates/ra_syntax/src/validation/char.rs
+++ b/crates/ra_syntax/src/validation/char.rs
@@ -92,12 +92,11 @@ fn validate_ascii_code_escape(text: &str, range: TextRange, errors: &mut Vec<Syn
92 if !text.is_ascii() { 92 if !text.is_ascii() {
93 // TODO: Give a more precise error message (say what the invalid character was) 93 // TODO: Give a more precise error message (say what the invalid character was)
94 errors.push(SyntaxError::new(AsciiCodeEscapeOutOfRange, range)); 94 errors.push(SyntaxError::new(AsciiCodeEscapeOutOfRange, range));
95 } 95 } else if text.chars().count() < 4 {
96 if text.len() < 4 {
97 errors.push(SyntaxError::new(TooShortAsciiCodeEscape, range)); 96 errors.push(SyntaxError::new(TooShortAsciiCodeEscape, range));
98 } else { 97 } else {
99 assert_eq!( 98 assert_eq!(
100 text.len(), 99 text.chars().count(),
101 4, 100 4,
102 "AsciiCodeEscape cannot be longer than 4 chars, but text '{}' is", 101 "AsciiCodeEscape cannot be longer than 4 chars, but text '{}' is",
103 text, 102 text,