diff --git a/src/lib/parser/statement/parse.rs b/src/lib/parser/statement/parse.rs index 5e31497fe43dbd7069df8894b0cb4dce7566fcaa..9ac851a1ce490460328f69cd7d856d9e51424b44 100644 --- a/src/lib/parser/statement/parse.rs +++ b/src/lib/parser/statement/parse.rs @@ -27,11 +27,9 @@ where } pub fn is_valid_name(name: &str) -> bool { - if !(name.as_bytes()[0] as char).is_numeric() { - !name.chars().any(|c| !(c.is_alphanumeric() || c == '_')) - } else { - false - } + let mut bytes = name.bytes(); + bytes.next().map_or(false, |b| b.is_ascii_alphabetic()) + && bytes.all(|b| b.is_ascii_alphanumeric() || b == b'_') } pub(crate) fn parse(code: &str) -> Statement {