aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-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,