Skip to content

Commit 6bc3a73

Browse files
ojedaariel-miculas
authored andcommitted
rust: syn: remove unicode-ident dependency
The `syn` crate depends on the `unicode-ident` crate to determine whether characters have the XID_Start or XID_Continue properties according to Unicode Standard Annex Rust-for-Linux#31. However, we only need ASCII identifiers in the kernel, thus we can simplify the check and remove completely that dependency. Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
1 parent 1daf5c1 commit 6bc3a73

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

rust/syn/ident.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,11 @@ impl From<Token![_]> for Ident {
9191
pub fn xid_ok(symbol: &str) -> bool {
9292
let mut chars = symbol.chars();
9393
let first = chars.next().unwrap();
94-
if !(first == '_' || unicode_ident::is_xid_start(first)) {
94+
if !(first == '_' || first.is_ascii_alphabetic()) {
9595
return false;
9696
}
9797
for ch in chars {
98-
if !unicode_ident::is_xid_continue(ch) {
98+
if !(ch == '_' || ch.is_ascii_alphanumeric()) {
9999
return false;
100100
}
101101
}

0 commit comments

Comments
 (0)