Skip to content

Commit a56b0e9

Browse files
committed
Simplify using is_ascii_alphabetic and is_ascii_alphanumeric
1 parent e533bb7 commit a56b0e9

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

compiler/rustc_builtin_macros/src/format_foreign.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -716,17 +716,11 @@ pub mod shell {
716716
}
717717

718718
fn is_ident_head(c: char) -> bool {
719-
match c {
720-
'a'..='z' | 'A'..='Z' | '_' => true,
721-
_ => false,
722-
}
719+
c.is_ascii_alphabetic() || c == '_'
723720
}
724721

725722
fn is_ident_tail(c: char) -> bool {
726-
match c {
727-
'0'..='9' => true,
728-
c => is_ident_head(c),
729-
}
723+
c.is_ascii_alphanumeric() || c == '_'
730724
}
731725

732726
#[cfg(test)]

0 commit comments

Comments
 (0)