mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-16 01:38:13 +00:00
Use an else if
This commit is contained in:
parent
72ab6f7727
commit
0fd87cbc47
1 changed files with 2 additions and 3 deletions
|
@ -92,12 +92,11 @@ fn validate_ascii_code_escape(text: &str, range: TextRange, errors: &mut Vec<Syn
|
|||
if !text.is_ascii() {
|
||||
// TODO: Give a more precise error message (say what the invalid character was)
|
||||
errors.push(SyntaxError::new(AsciiCodeEscapeOutOfRange, range));
|
||||
}
|
||||
if text.len() < 4 {
|
||||
} else if text.chars().count() < 4 {
|
||||
errors.push(SyntaxError::new(TooShortAsciiCodeEscape, range));
|
||||
} else {
|
||||
assert_eq!(
|
||||
text.len(),
|
||||
text.chars().count(),
|
||||
4,
|
||||
"AsciiCodeEscape cannot be longer than 4 chars, but text '{}' is",
|
||||
text,
|
||||
|
|
Loading…
Reference in a new issue