Make clippy happy

This commit is contained in:
Loïc Lecrenier 2022-10-27 13:00:30 +02:00
parent 7b93ba40bd
commit 4f4fc20acf
3 changed files with 14 additions and 12 deletions

View File

@ -855,9 +855,9 @@ impl IndexScheduler {
} }
// 2. Get the task set for index = name that appeared before the index swap task // 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..); 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..); index_rhs_task_ids.remove_range(task_id..);
// 3. before_name -> new_name in the task's KindWithContent // 3. before_name -> new_name in the task's KindWithContent

View File

@ -451,7 +451,7 @@ impl IndexScheduler {
let ProcessingTasks { started_at: started_at_processing, processing: processing_tasks } = let ProcessingTasks { started_at: started_at_processing, processing: processing_tasks } =
self.processing_tasks.read().unwrap().clone(); 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 { if let Some(from) = &query.from {
tasks.remove_range(from.saturating_add(1)..); tasks.remove_range(from.saturating_add(1)..);
@ -465,7 +465,7 @@ impl IndexScheduler {
Status::Processing => { Status::Processing => {
status_tasks |= &processing_tasks; 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) { if !status.contains(&Status::Processing) {
@ -482,7 +482,7 @@ impl IndexScheduler {
if let Some(kind) = &query.kind { if let Some(kind) = &query.kind {
let mut kind_tasks = RoaringBitmap::new(); let mut kind_tasks = RoaringBitmap::new();
for kind in kind { for kind in kind {
kind_tasks |= self.get_kind(&rtxn, *kind)?; kind_tasks |= self.get_kind(rtxn, *kind)?;
} }
tasks &= &kind_tasks; tasks &= &kind_tasks;
} }
@ -490,7 +490,7 @@ impl IndexScheduler {
if let Some(index) = &query.index_uid { if let Some(index) = &query.index_uid {
let mut index_tasks = RoaringBitmap::new(); let mut index_tasks = RoaringBitmap::new();
for index in index { for index in index {
index_tasks |= self.index_tasks(&rtxn, index)?; index_tasks |= self.index_tasks(rtxn, index)?;
} }
tasks &= &index_tasks; tasks &= &index_tasks;
} }
@ -531,7 +531,7 @@ impl IndexScheduler {
}; };
keep_tasks_within_datetimes( keep_tasks_within_datetimes(
&rtxn, rtxn,
&mut filtered_non_processing_tasks, &mut filtered_non_processing_tasks,
self.started_at, self.started_at,
query.after_started_at, query.after_started_at,
@ -541,7 +541,7 @@ impl IndexScheduler {
}; };
keep_tasks_within_datetimes( keep_tasks_within_datetimes(
&rtxn, rtxn,
&mut tasks, &mut tasks,
self.enqueued_at, self.enqueued_at,
query.after_enqueued_at, query.after_enqueued_at,
@ -549,7 +549,7 @@ impl IndexScheduler {
)?; )?;
keep_tasks_within_datetimes( keep_tasks_within_datetimes(
&rtxn, rtxn,
&mut tasks, &mut tasks,
self.finished_at, self.finished_at,
query.after_finished_at, query.after_finished_at,
@ -589,7 +589,7 @@ impl IndexScheduler {
query: &Query, query: &Query,
authorized_indexes: &Option<Vec<String>>, authorized_indexes: &Option<Vec<String>>,
) -> Result<RoaringBitmap> { ) -> Result<RoaringBitmap> {
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 // 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) // from the result (because it is not publicly associated with any index)

View File

@ -465,8 +465,10 @@ async fn get_task(
analytics.publish("Tasks Seen".to_string(), json!({ "per_task_uid": true }), Some(&req)); analytics.publish("Tasks Seen".to_string(), json!({ "per_task_uid": true }), Some(&req));
let mut query = index_scheduler::Query::default(); let query = index_scheduler::Query {
query.uid = Some(vec![task_id]); uid: Some(vec![task_id]),
..Query::default()
};
if let Some(task) = index_scheduler if let Some(task) = index_scheduler
.get_tasks_from_authorized_indexes( .get_tasks_from_authorized_indexes(