Simplify using is_ascii_alphabetic and is_ascii_alphanumeric

This commit is contained in:
LingMan 2020-09-23 06:49:42 +02:00
parent e533bb73bc
commit a56b0e96d0

View file

@ -716,17 +716,11 @@ pub mod shell {
} }
fn is_ident_head(c: char) -> bool { fn is_ident_head(c: char) -> bool {
match c { c.is_ascii_alphabetic() || c == '_'
'a'..='z' | 'A'..='Z' | '_' => true,
_ => false,
}
} }
fn is_ident_tail(c: char) -> bool { fn is_ident_tail(c: char) -> bool {
match c { c.is_ascii_alphanumeric() || c == '_'
'0'..='9' => true,
c => is_ident_head(c),
}
} }
#[cfg(test)] #[cfg(test)]