Skip to content

Commit

Permalink
rust: proc-macro2: remove unicode_ident dependency
Browse files Browse the repository at this point in the history
The `proc-macro2` crate depends on the `unicode-ident` crate
to determine whether characters have the XID_Start or XID_Continue
properties according to Unicode Standard Annex torvalds#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>
  • Loading branch information
ojeda committed Apr 10, 2024
1 parent 617c120 commit 24954e2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rust/proc-macro2/fallback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -826,11 +826,11 @@ impl Ident {
}

pub(crate) fn is_ident_start(c: char) -> bool {
c == '_' || unicode_ident::is_xid_start(c)
c == '_' || c.is_ascii_alphabetic()
}

pub(crate) fn is_ident_continue(c: char) -> bool {
unicode_ident::is_xid_continue(c)
c == '_' || c.is_ascii_alphanumeric()
}

#[track_caller]
Expand Down

0 comments on commit 24954e2

Please sign in to comment.