diff --git a/index-scheduler/src/batch.rs b/index-scheduler/src/batch.rs index 7ca3bfb20..23fb5a46b 100644 --- a/index-scheduler/src/batch.rs +++ b/index-scheduler/src/batch.rs @@ -1060,9 +1060,17 @@ impl IndexScheduler { let (new_builder, user_result) = builder.add_documents(reader)?; builder = new_builder; - let Some(Details::DocumentAdditionOrUpdate { received_documents, .. }) = task.details - // In the case of a `documentAdditionOrUpdate` the details MUST be set - else { unreachable!(); }; + let received_documents = + if let Some(Details::DocumentAdditionOrUpdate { + received_documents, + .. + }) = task.details + { + received_documents + } else { + // In the case of a `documentAdditionOrUpdate` the details MUST be set + unreachable!(); + }; match user_result { Ok(count) => { @@ -1087,9 +1095,15 @@ impl IndexScheduler { builder.remove_documents(document_ids)?; builder = new_builder; - let Some(Details::DocumentDeletion { provided_ids, .. }) = task.details - // In the case of a `documentAdditionOrUpdate` the details MUST be set - else { unreachable!(); }; + let provided_ids = + if let Some(Details::DocumentDeletion { provided_ids, .. }) = + task.details + { + provided_ids + } else { + // In the case of a `documentAdditionOrUpdate` the details MUST be set + unreachable!(); + }; match user_result { Ok(count) => { diff --git a/index-scheduler/src/utils.rs b/index-scheduler/src/utils.rs index f68371767..acb520513 100644 --- a/index-scheduler/src/utils.rs +++ b/index-scheduler/src/utils.rs @@ -440,10 +440,16 @@ impl IndexScheduler { deleted_documents, } => { assert_eq!(kind.as_kind(), Kind::DocumentDeletion); - let KindWithContent::DocumentDeletion { - ref index_uid, - ref documents_ids, - } = kind else { unreachable!() }; + let (index_uid, documents_ids) = + if let KindWithContent::DocumentDeletion { + ref index_uid, + ref documents_ids, + } = kind + { + (index_uid, documents_ids) + } else { + unreachable!() + }; assert_eq!(&task_index_uid.unwrap(), index_uid); match status {