feat: Assert that query are not invalid ones

This commit is contained in:
Clément Renault 2018-08-29 21:21:37 +02:00
parent f5dd776efd
commit f0f5fc9891

View File

@ -16,6 +16,8 @@ impl LevBuilder {
} }
pub fn get_automaton(&self, query: &str) -> Levenshtein { pub fn get_automaton(&self, query: &str) -> Levenshtein {
assert!(!query.is_empty());
let dfa = if query.len() <= 4 { let dfa = if query.len() <= 4 {
self.automatons[0].build_prefix_dfa(query) self.automatons[0].build_prefix_dfa(query)
} else if query.len() <= 8 { } else if query.len() <= 8 {