From 4f4fc20acfe52115c8cca178193c895f3b150f2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Lecrenier?= Date: Thu, 27 Oct 2022 13:00:30 +0200 Subject: [PATCH] Make clippy happy --- index-scheduler/src/batch.rs | 4 ++-- index-scheduler/src/lib.rs | 16 ++++++++-------- meilisearch-http/src/routes/tasks.rs | 6 ++++-- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/index-scheduler/src/batch.rs b/index-scheduler/src/batch.rs index a1a45df9f..90ac4f8df 100644 --- a/index-scheduler/src/batch.rs +++ b/index-scheduler/src/batch.rs @@ -855,9 +855,9 @@ impl IndexScheduler { } // 2. Get the task set for index = name that appeared before the index swap task - let mut index_lhs_task_ids = self.index_tasks(&wtxn, lhs)?; + let mut index_lhs_task_ids = self.index_tasks(wtxn, lhs)?; index_lhs_task_ids.remove_range(task_id..); - let mut index_rhs_task_ids = self.index_tasks(&wtxn, rhs)?; + let mut index_rhs_task_ids = self.index_tasks(wtxn, rhs)?; index_rhs_task_ids.remove_range(task_id..); // 3. before_name -> new_name in the task's KindWithContent diff --git a/index-scheduler/src/lib.rs b/index-scheduler/src/lib.rs index 6b8037e4e..67ce09ec0 100644 --- a/index-scheduler/src/lib.rs +++ b/index-scheduler/src/lib.rs @@ -451,7 +451,7 @@ impl IndexScheduler { let ProcessingTasks { started_at: started_at_processing, processing: processing_tasks } = self.processing_tasks.read().unwrap().clone(); - let mut tasks = self.all_task_ids(&rtxn)?; + let mut tasks = self.all_task_ids(rtxn)?; if let Some(from) = &query.from { tasks.remove_range(from.saturating_add(1)..); @@ -465,7 +465,7 @@ impl IndexScheduler { Status::Processing => { status_tasks |= &processing_tasks; } - status => status_tasks |= &self.get_status(&rtxn, *status)?, + status => status_tasks |= &self.get_status(rtxn, *status)?, }; } if !status.contains(&Status::Processing) { @@ -482,7 +482,7 @@ impl IndexScheduler { if let Some(kind) = &query.kind { let mut kind_tasks = RoaringBitmap::new(); for kind in kind { - kind_tasks |= self.get_kind(&rtxn, *kind)?; + kind_tasks |= self.get_kind(rtxn, *kind)?; } tasks &= &kind_tasks; } @@ -490,7 +490,7 @@ impl IndexScheduler { if let Some(index) = &query.index_uid { let mut index_tasks = RoaringBitmap::new(); for index in index { - index_tasks |= self.index_tasks(&rtxn, index)?; + index_tasks |= self.index_tasks(rtxn, index)?; } tasks &= &index_tasks; } @@ -531,7 +531,7 @@ impl IndexScheduler { }; keep_tasks_within_datetimes( - &rtxn, + rtxn, &mut filtered_non_processing_tasks, self.started_at, query.after_started_at, @@ -541,7 +541,7 @@ impl IndexScheduler { }; keep_tasks_within_datetimes( - &rtxn, + rtxn, &mut tasks, self.enqueued_at, query.after_enqueued_at, @@ -549,7 +549,7 @@ impl IndexScheduler { )?; keep_tasks_within_datetimes( - &rtxn, + rtxn, &mut tasks, self.finished_at, query.after_finished_at, @@ -589,7 +589,7 @@ impl IndexScheduler { query: &Query, authorized_indexes: &Option>, ) -> Result { - let mut tasks = self.get_task_ids(rtxn, &query)?; + let mut tasks = self.get_task_ids(rtxn, query)?; // If the query contains a list of index_uid, then we must exclude IndexSwap tasks // from the result (because it is not publicly associated with any index) diff --git a/meilisearch-http/src/routes/tasks.rs b/meilisearch-http/src/routes/tasks.rs index 1d4b6a054..110f6d40b 100644 --- a/meilisearch-http/src/routes/tasks.rs +++ b/meilisearch-http/src/routes/tasks.rs @@ -465,8 +465,10 @@ async fn get_task( analytics.publish("Tasks Seen".to_string(), json!({ "per_task_uid": true }), Some(&req)); - let mut query = index_scheduler::Query::default(); - query.uid = Some(vec![task_id]); + let query = index_scheduler::Query { + uid: Some(vec![task_id]), + ..Query::default() + }; if let Some(task) = index_scheduler .get_tasks_from_authorized_indexes(