style: Address clippy

This commit is contained in:
Ed Page 2021-03-29 20:28:01 -05:00
parent 8365351dba
commit d51725b2a4
2 changed files with 13 additions and 6 deletions

View file

@ -289,9 +289,9 @@ impl EngineConfig {
tokenizer: Some( tokenizer: Some(
empty empty
.tokenizer .tokenizer
.unwrap_or_else(|| TokenizerConfig::from_defaults()), .unwrap_or_else(TokenizerConfig::from_defaults),
), ),
dict: Some(empty.dict.unwrap_or_else(|| DictConfig::from_defaults())), dict: Some(empty.dict.unwrap_or_else(DictConfig::from_defaults)),
} }
} }

View file

@ -19,12 +19,19 @@ impl ConfigStorage {
self.arena self.arena
.lock() .lock()
.unwrap() .unwrap()
.alloc(kstring::KString::from_ref(other)), .alloc(kstring::KString::from_ref(other))
.as_str(),
) )
} }
} }
} }
impl Default for ConfigStorage {
fn default() -> Self {
Self::new()
}
}
pub struct ConfigEngine<'s> { pub struct ConfigEngine<'s> {
storage: &'s ConfigStorage, storage: &'s ConfigStorage,
@ -145,8 +152,8 @@ impl<'s> ConfigEngine<'s> {
tokenizer, dict, .. tokenizer, dict, ..
} = default; } = default;
let tokenizer_config = let tokenizer_config =
tokenizer.unwrap_or_else(|| crate::config::TokenizerConfig::from_defaults()); tokenizer.unwrap_or_else(crate::config::TokenizerConfig::from_defaults);
let dict_config = dict.unwrap_or_else(|| crate::config::DictConfig::from_defaults()); let dict_config = dict.unwrap_or_else(crate::config::DictConfig::from_defaults);
let tokenizer = typos::tokens::TokenizerBuilder::new() let tokenizer = typos::tokens::TokenizerBuilder::new()
.ignore_hex(tokenizer_config.ignore_hex()) .ignore_hex(tokenizer_config.ignore_hex())
@ -177,7 +184,7 @@ impl<'s> ConfigEngine<'s> {
files, files,
check_filenames: check_filename, check_filenames: check_filename,
check_files: check_file, check_files: check_file,
binary: binary, binary,
tokenizer, tokenizer,
dict, dict,
}; };