From 1647ca3c1f929a1ceb67e5c9ec6fb24a5c96bcb1 Mon Sep 17 00:00:00 2001 From: ad hoc Date: Wed, 25 May 2022 15:07:52 +0200 Subject: [PATCH] fix clipy warnings --- meilisearch-lib/src/tasks/handlers/dump_handler.rs | 4 +--- meilisearch-lib/src/tasks/handlers/empty_handler.rs | 4 +--- .../src/tasks/handlers/index_resolver_handler.rs | 10 +++++----- meilisearch-lib/src/tasks/handlers/snapshot_handler.rs | 9 ++------- meilisearch-lib/src/tasks/task_store/store.rs | 2 +- 5 files changed, 10 insertions(+), 19 deletions(-) diff --git a/meilisearch-lib/src/tasks/handlers/dump_handler.rs b/meilisearch-lib/src/tasks/handlers/dump_handler.rs index e826242f4..715beafee 100644 --- a/meilisearch-lib/src/tasks/handlers/dump_handler.rs +++ b/meilisearch-lib/src/tasks/handlers/dump_handler.rs @@ -35,9 +35,7 @@ where } } - async fn finish(&self, _: &Batch) { - () - } + async fn finish(&self, _: &Batch) {} } #[cfg(test)] diff --git a/meilisearch-lib/src/tasks/handlers/empty_handler.rs b/meilisearch-lib/src/tasks/handlers/empty_handler.rs index 5d6aa2275..d800e1965 100644 --- a/meilisearch-lib/src/tasks/handlers/empty_handler.rs +++ b/meilisearch-lib/src/tasks/handlers/empty_handler.rs @@ -14,7 +14,5 @@ impl BatchHandler for EmptyBatchHandler { batch } - async fn finish(&self, _: &Batch) { - () - } + async fn finish(&self, _: &Batch) {} } diff --git a/meilisearch-lib/src/tasks/handlers/index_resolver_handler.rs b/meilisearch-lib/src/tasks/handlers/index_resolver_handler.rs index a744dcaad..a34082afe 100644 --- a/meilisearch-lib/src/tasks/handlers/index_resolver_handler.rs +++ b/meilisearch-lib/src/tasks/handlers/index_resolver_handler.rs @@ -13,10 +13,10 @@ where I: IndexStore + Send + Sync + 'static, { fn accept(&self, batch: &Batch) -> bool { - match batch.content { - BatchContent::DocumentsAdditionBatch(_) | BatchContent::IndexUpdate(_) => true, - _ => false, - } + matches!( + batch.content, + BatchContent::DocumentsAdditionBatch(_) | BatchContent::IndexUpdate(_) + ) } async fn process_batch(&self, mut batch: Batch) -> Batch { @@ -26,7 +26,7 @@ where .process_document_addition_batch(std::mem::take(tasks)) .await; } - BatchContent::IndexUpdate(ref mut task) => match self.process_task(&task).await { + BatchContent::IndexUpdate(ref mut task) => match self.process_task(task).await { Ok(success) => { task.events.push(TaskEvent::Succeded { result: success, diff --git a/meilisearch-lib/src/tasks/handlers/snapshot_handler.rs b/meilisearch-lib/src/tasks/handlers/snapshot_handler.rs index 2948fb4ff..32fe6d746 100644 --- a/meilisearch-lib/src/tasks/handlers/snapshot_handler.rs +++ b/meilisearch-lib/src/tasks/handlers/snapshot_handler.rs @@ -6,10 +6,7 @@ pub struct SnapshotHandler; #[async_trait::async_trait] impl BatchHandler for SnapshotHandler { fn accept(&self, batch: &Batch) -> bool { - match batch.content { - BatchContent::Snapshot(_) => true, - _ => false, - } + matches!(batch.content, BatchContent::Snapshot(_)) } async fn process_batch(&self, batch: Batch) -> Batch { @@ -25,7 +22,5 @@ impl BatchHandler for SnapshotHandler { Batch::empty() } - async fn finish(&self, _: &Batch) { - () - } + async fn finish(&self, _: &Batch) {} } diff --git a/meilisearch-lib/src/tasks/task_store/store.rs b/meilisearch-lib/src/tasks/task_store/store.rs index 902f80560..75ece0ae8 100644 --- a/meilisearch-lib/src/tasks/task_store/store.rs +++ b/meilisearch-lib/src/tasks/task_store/store.rs @@ -110,7 +110,7 @@ impl Store { self.tasks.put(txn, &BEU64::new(task.id), task)?; // only add the task to the indexes index if it has an index_uid if let Some(ref index_uid) = task.index_uid { - self.uids_task_ids.put(txn, &(&index_uid, task.id), &())?; + self.uids_task_ids.put(txn, &(index_uid, task.id), &())?; } Ok(())