From 1941072bb29ba7763519d85ef59797e634d0f82e Mon Sep 17 00:00:00 2001 From: ad hoc Date: Thu, 31 Mar 2022 18:44:51 +0200 Subject: [PATCH] implement Copy on Setting --- milli/src/update/settings.rs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/milli/src/update/settings.rs b/milli/src/update/settings.rs index 94ae29595..c03d6e0ae 100644 --- a/milli/src/update/settings.rs +++ b/milli/src/update/settings.rs @@ -14,7 +14,7 @@ use crate::update::index_documents::IndexDocumentsMethod; use crate::update::{ClearDocuments, IndexDocuments, UpdateIndexingStep}; use crate::{FieldsIdsMap, Index, Result}; -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Copy)] pub enum Setting { Set(T), Reset, @@ -495,29 +495,29 @@ impl<'a, 't, 'u, 'i> Settings<'a, 't, 'u, 'i> { } fn update_min_typo_word_len(&mut self) -> Result<()> { - match (&self.min_word_len_one_typo, &self.min_word_len_two_typos) { + match (self.min_word_len_one_typo, self.min_word_len_two_typos) { (Setting::Set(one), Setting::Set(two)) => { if one > two { - return Err(UserError::InvalidMinTypoWordLenSetting(*one, *two).into()); + return Err(UserError::InvalidMinTypoWordLenSetting(one, two).into()); } else { - self.index.put_min_word_len_one_typo(&mut self.wtxn, *one)?; - self.index.put_min_word_len_two_typos(&mut self.wtxn, *two)?; + self.index.put_min_word_len_one_typo(&mut self.wtxn, one)?; + self.index.put_min_word_len_two_typos(&mut self.wtxn, two)?; } } (Setting::Set(one), _) => { let two = self.index.min_word_len_two_typos(&self.wtxn)?; - if *one > two { - return Err(UserError::InvalidMinTypoWordLenSetting(*one, two).into()); + if one > two { + return Err(UserError::InvalidMinTypoWordLenSetting(one, two).into()); } else { - self.index.put_min_word_len_one_typo(&mut self.wtxn, *one)?; + self.index.put_min_word_len_one_typo(&mut self.wtxn, one)?; } } (_, Setting::Set(two)) => { let one = self.index.min_word_len_one_typo(&self.wtxn)?; - if one > *two { - return Err(UserError::InvalidMinTypoWordLenSetting(one, *two).into()); + if one > two { + return Err(UserError::InvalidMinTypoWordLenSetting(one, two).into()); } else { - self.index.put_min_word_len_two_typos(&mut self.wtxn, *two)?; + self.index.put_min_word_len_two_typos(&mut self.wtxn, two)?; } } _ => (),