Skip to content

Commit

Permalink
see if this has any impact
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexWaygood committed Mar 14, 2024
1 parent 6c99e26 commit d79042e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions crates/ruff_python_semantic/src/scope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::ops::{Deref, DerefMut};
use bitflags::bitflags;
use ruff_python_ast as ast;
use rustc_hash::FxHashMap;
use unicode_normalization::UnicodeNormalization;
use unicode_normalization::{is_nfkc_quick, IsNormalized, UnicodeNormalization};

use ruff_index::{newtype_index, Idx, IndexSlice, IndexVec};

Expand All @@ -22,7 +22,7 @@ struct Bindings<'a>(FxHashMap<Cow<'a, str>, BindingId>);
impl<'a> Bindings<'a> {
#[inline]
fn get(&self, name: &str) -> Option<&BindingId> {
if name.is_ascii() {
if matches!(is_nfkc_quick(name.chars()), IsNormalized::Yes) {
self.0.get(name)
} else {
self.0.get(&*name.nfkc().collect::<String>())
Expand All @@ -31,7 +31,7 @@ impl<'a> Bindings<'a> {

#[inline]
fn insert(&mut self, name: &'a str, value: BindingId) -> Option<BindingId> {
if name.is_ascii() {
if matches!(is_nfkc_quick(name.chars()), IsNormalized::Yes) {
self.0.insert(Cow::Borrowed(name), value)
} else {
self.0.insert(Cow::Owned(name.nfkc().collect()), value)
Expand All @@ -40,7 +40,7 @@ impl<'a> Bindings<'a> {

#[inline]
fn contains_key(&self, key: &str) -> bool {
if key.is_ascii() {
if matches!(is_nfkc_quick(key.chars()), IsNormalized::Yes) {
self.0.contains_key(key)
} else {
self.0.contains_key(&*key.nfkc().collect::<String>())
Expand Down

0 comments on commit d79042e

Please sign in to comment.