Skip to content

Commit

Permalink
Merge pull request #325 from dtolnay/xid
Browse files Browse the repository at this point in the history
Rely on unicode-xid to optimize ASCII properly
  • Loading branch information
dtolnay committed Apr 6, 2022
2 parents 1bbc8b1 + affce36 commit f09fb00
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Expand Up @@ -25,7 +25,7 @@ targets = ["x86_64-unknown-linux-gnu"]
features = ["span-locations"]

[dependencies]
unicode-xid = "0.2"
unicode-xid = "0.2.2"

[dev-dependencies]
quote = { version = "1.0", default_features = false }
Expand Down
11 changes: 2 additions & 9 deletions src/fallback.rs
Expand Up @@ -666,18 +666,11 @@ impl Ident {
}

pub(crate) fn is_ident_start(c: char) -> bool {
('a' <= c && c <= 'z')
|| ('A' <= c && c <= 'Z')
|| c == '_'
|| (c > '\x7f' && UnicodeXID::is_xid_start(c))
c == '_' || UnicodeXID::is_xid_start(c)
}

pub(crate) fn is_ident_continue(c: char) -> bool {
('a' <= c && c <= 'z')
|| ('A' <= c && c <= 'Z')
|| c == '_'
|| ('0' <= c && c <= '9')
|| (c > '\x7f' && UnicodeXID::is_xid_continue(c))
UnicodeXID::is_xid_continue(c)
}

fn validate_ident(string: &str) {
Expand Down

0 comments on commit f09fb00

Please sign in to comment.