Merge pull request #1196 from epage/fix

fix(dictgen): Align trie write/access conditions
This commit is contained in:
Ed Page 2024-12-30 14:43:31 -06:00 committed by GitHub
commit c6beb8b05a
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: B5690EEEBB952194

View file

@ -34,7 +34,12 @@ pub struct DictTrie<V: 'static> {
impl<V> DictTrie<V> { impl<V> DictTrie<V> {
#[inline] #[inline]
pub fn find(&self, word: &'_ unicase::UniCase<&str>) -> Option<&'static V> { pub fn find(&self, word: &'_ unicase::UniCase<&str>) -> Option<&'static V> {
if word.is_ascii() { if word
.into_inner()
.as_bytes()
.iter()
.all(|b| b.is_ascii_alphabetic())
{
if self.range.contains(&word.len()) { if self.range.contains(&word.len()) {
self.find_ascii(word.as_bytes()) self.find_ascii(word.as_bytes())
} else { } else {