mirror of
https://github.com/crate-ci/typos.git
synced 2025-01-26 16:39:07 -05:00
fix(dictgen): Align trie write/access conditions
This commit is contained in:
parent
b87cd87116
commit
bd7c3df5db
1 changed files with 6 additions and 1 deletions
|
@ -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 {
|
||||||
|
|
Loading…
Add table
Reference in a new issue