Repository: meilisearch/meilisearch
File: meilisearch-lib/src/index_resolver/mod.rs (Rust)

Code before:

                    Ok(TaskResult::DocumentDeletion { deleted_documents })
                }
                TaskContent::DocumentDeletion {
                    deletion: DocumentDeletion::Clear,
                    index_uid,
                } => {
                    let index = self.get_index(index_uid.clone().into_inner()).await?;
                    let deleted_documents = spawn_blocking(move || -> IndexResult<u64> {
                        let number_documents = index.stats()?.number_of_documents;
                        index.clear_documents()?;
                        Ok(number_documents)
                    })
                    .await??;

                    Ok(TaskResult::ClearAll { deleted_documents })
                }
                TaskContent::SettingsUpdate {
                    settings,
                    is_deletion,
                    allow_index_creation,
                    index_uid,
                } => {
                    let index = if *is_deletion || !*allow_index_creation {
                        self.get_index(index_uid.clone().into_inner()).await?
                    } else {
                        self.get_or_create_index(index_uid.clone(), task.id).await?
                    };

                    let settings = settings.clone();
                    spawn_blocking(move || index.update_settings(&settings.check())).await??;

                    Ok(TaskResult::Other)
                }
                TaskContent::IndexDeletion { index_uid } => {
                    let index = self.delete_index(index_uid.clone().into_inner()).await?;

                    let deleted_documents = spawn_blocking(move || -> IndexResult<u64> {
                        Ok(index.stats()?.number_of_documents)
                    })
                    .await??;

                    Ok(TaskResult::ClearAll { deleted_documents })
                }
                TaskContent::IndexCreation {
                    primary_key,
                    index_uid,
                } => {
                    let index = self.create_index(index_uid.clone(), task.id).await?;

                    if let Some(primary_key) = primary_key {

Review comment (suggestion):
```suggestion
                TaskContent::DocumentDeletion {
                    deletion: DocumentDeletion::Ids(ref ids),
                    index_uid,
                } => {
                    let index = self.get_index(index_uid.clone().into_inner()).await?;

                    let DocumentDeletionResult {
                        deleted_documents, ..
                    } = spawn_blocking(move || index.delete_documents(&ids)).await??;
```

Wouldn’t that work? (I removed the ids.clone)

Code after:
                    }
                }
                _ => panic!("invalid batch!"),
            }
        }

        pub async fn delete_content_file(&self, content_uuid: Uuid) -> Result<()> {
            self.file_store.delete(content_uuid).await?;
            Ok(())
        }

        async fn process_task_inner(&self, task: &Task) -> Result<TaskResult> {
            match &task.content {
                TaskContent::DocumentAddition { .. } => {
                    panic!("updates should be handled by batch")
                }
                TaskContent::DocumentDeletion {
                    deletion: DocumentDeletion::Ids(ids),
                    index_uid,
                } => {
                    let ids = ids.clone();
                    let index = self.get_index(index_uid.clone().into_inner()).await?;

                    let DocumentDeletionResult {
                        deleted_documents, ..
                    } = spawn_blocking(move || index.delete_documents(&ids)).await??;

                    Ok(TaskResult::DocumentDeletion { deleted_documents })
                }
                TaskContent::DocumentDeletion {
                    deletion: DocumentDeletion::Clear,
                    index_uid,
                } => {
                    let index = self.get_index(index_uid.clone().into_inner()).await?;
                    let deleted_documents = spawn_blocking(move || -> IndexResult<u64> {
                        let number_documents = index.stats()?.number_of_documents;
                        index.clear_documents()?;
                        Ok(number_documents)
                    })
                    .await??;

                    Ok(TaskResult::ClearAll { deleted_documents })
                }
                TaskContent::SettingsUpdate {
                    settings,
                    is_deletion,
                    allow_index_creation,
                    index_uid,
                } => {
                    let index = if *is_deletion || !*allow_index_creation {
                        self.get_index(index_uid.clone().into_inner()).await?