Skip to content

Commit

Permalink
Rely on unicode-xid to optimize ASCII properly
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Apr 6, 2022
1 parent 1bbc8b1 commit affce36
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 affce36

Please sign in to comment.