[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251110095025.1475896-17-ojeda@kernel.org>
Date: Mon, 10 Nov 2025 10:50:21 +0100
From: Miguel Ojeda <ojeda@...nel.org>
To: Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>,
Nathan Chancellor <nathan@...nel.org>,
Nicolas Schier <nicolas@...sle.eu>
Cc: Boqun Feng <boqun.feng@...il.com>,
Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <lossin@...nel.org>,
Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>,
Trevor Gross <tmgross@...ch.edu>,
Danilo Krummrich <dakr@...nel.org>,
rust-for-linux@...r.kernel.org,
linux-kbuild@...r.kernel.org,
linux-kernel@...r.kernel.org,
patches@...ts.linux.dev
Subject: [PATCH 16/18] 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 #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@...nel.org>
---
rust/syn/ident.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/rust/syn/ident.rs b/rust/syn/ident.rs
index 2c4b56505bec..03ccebf9c022 100644
--- a/rust/syn/ident.rs
+++ b/rust/syn/ident.rs
@@ -39,11 +39,11 @@ fn from(token: Token![_]) -> Ident {
pub(crate) fn xid_ok(symbol: &str) -> bool {
let mut chars = symbol.chars();
let first = chars.next().unwrap();
- if !(first == '_' || unicode_ident::is_xid_start(first)) {
+ if !(first == '_' || first.is_ascii_alphabetic()) {
return false;
}
for ch in chars {
- if !unicode_ident::is_xid_continue(ch) {
+ if !(ch == '_' || ch.is_ascii_alphanumeric()) {
return false;
}
}
--
2.51.2
Powered by blists - more mailing lists