From d51725b2a48e14fc8c63d5da5df4711f4450a3ab Mon Sep 17 00:00:00 2001 From: Ed Page Date: Mon, 29 Mar 2021 20:28:01 -0500 Subject: [PATCH] style: Address clippy --- src/config.rs | 4 ++-- src/policy.rs | 15 +++++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/config.rs b/src/config.rs index 6f9ca10..97cb9d5 100644 --- a/src/config.rs +++ b/src/config.rs @@ -289,9 +289,9 @@ impl EngineConfig { tokenizer: Some( empty .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)), } } diff --git a/src/policy.rs b/src/policy.rs index f5be135..92c8aa6 100644 --- a/src/policy.rs +++ b/src/policy.rs @@ -19,12 +19,19 @@ impl ConfigStorage { self.arena .lock() .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> { storage: &'s ConfigStorage, @@ -145,8 +152,8 @@ impl<'s> ConfigEngine<'s> { tokenizer, dict, .. } = default; let tokenizer_config = - tokenizer.unwrap_or_else(|| crate::config::TokenizerConfig::from_defaults()); - let dict_config = dict.unwrap_or_else(|| crate::config::DictConfig::from_defaults()); + tokenizer.unwrap_or_else(crate::config::TokenizerConfig::from_defaults); + let dict_config = dict.unwrap_or_else(crate::config::DictConfig::from_defaults); let tokenizer = typos::tokens::TokenizerBuilder::new() .ignore_hex(tokenizer_config.ignore_hex()) @@ -177,7 +184,7 @@ impl<'s> ConfigEngine<'s> { files, check_filenames: check_filename, check_files: check_file, - binary: binary, + binary, tokenizer, dict, };