Skip to content

Commit 82e9a4f

Browse files
committed
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 cef2d41 commit 82e9a4f

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
@@ -39,11 +39,11 @@ impl From<Token![_]> for Ident {
3939
pub(crate) fn xid_ok(symbol: &str) -> bool {
4040
let mut chars = symbol.chars();
4141
let first = chars.next().unwrap();
42-
if !(first == '_' || unicode_ident::is_xid_start(first)) {
42+
if !(first == '_' || first.is_ascii_alphabetic()) {
4343
return false;
4444
}
4545
for ch in chars {
46-
if !unicode_ident::is_xid_continue(ch) {
46+
if !(ch == '_' || ch.is_ascii_alphanumeric()) {
4747
return false;
4848
}
4949
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy