Replace unreachable_patterns tag with explicit feature use

This commit is contained in:
Steven Roose 2024-01-29 18:29:38 +00:00
parent 51fd048e86
commit d8b046da28
No known key found for this signature in database
GPG Key ID: 2F2A88D7F8D68E87
1 changed files with 8 additions and 1 deletions

View File

@ -163,7 +163,6 @@ impl Language {
/// Get the index of the word in the word list.
#[inline]
#[allow(unreachable_patterns)]
pub fn find_word(self, word: &str) -> Option<u16> {
match self {
// English, Portuguese, Italian, and Korean wordlists are already lexicographically
@ -178,6 +177,14 @@ impl Language {
// All other languages' wordlists are not lexicographically sorted, so we have to
// resort to linear search
#[cfg(any(
feature = "chinese-simplified",
feature = "chinese-traditional",
feature = "czech",
feature = "french",
feature = "japanese",
feature = "spanish",
))]
_ => self.word_list().iter().position(|w| *w == word).map(|i| i as u16),
}
}