Repository: meilisearch/meilisearch
File: crates/meilisearch-types/src/task_view.rs (Rust)

Code before:
                (None, Some(uid)) | (Some(uid), None) => Some(uid),
                // We should never be able to batch multiple renames at the same time.
                (Some(left), Some(_right)) => Some(left),
            },
            new_index_uid: match (self.new_index_uid.clone(), other.new_index_uid.clone()) {
                (None, None) => None,
                (None, Some(uid)) | (Some(uid), None) => Some(uid),
                // We should never be able to batch multiple renames at the same time.
                (Some(left), Some(_right)) => Some(left),
            },
            pre_compaction_size: match (
                self.pre_compaction_size.clone(),
                other.pre_compaction_size.clone(),
            ) {
                (None, None) => None,
                (None, Some(size)) | (Some(size), None) => Some(size),
                // We should never be able to batch multiple compactions at the same time.
                (Some(left), Some(_right)) => Some(left),
            },
            post_compaction_size: match (
                self.post_compaction_size.clone(),
                other.post_compaction_size.clone(),
            ) {
                (None, None) => None,
                (None, Some(size)) | (Some(size), None) => Some(size),
                // We should never be able to batch multiple renames at the same time.
                (Some(left), Some(_right)) => Some(left),
            },
        }
    }
}

impl From<Details> for DetailsView {
    fn from(details: Details) -> Self {
        match details {
            Details::DocumentAdditionOrUpdate { received_documents, indexed_documents } => {
                DetailsView {
                    received_documents: Some(received_documents),
                    indexed_documents: Some(indexed_documents),
                    ..DetailsView::default()
                }
            }
            Details::DocumentEdition {
                deleted_documents,
                edited_documents,
                original_filter,
                context,
                function,
            } => DetailsView {
                deleted_documents: Some(deleted_documents),
                edited_documents: Some(edited_documents),

Review comment (performance):
```suggestion
                // We should never be able to batch multiple compactions at the same time.
```

Code after:
                (None, Some(uid)) | (Some(uid), None) => Some(uid),
                // We should never be able to batch multiple renames at the same time.
                (Some(left), Some(_right)) => Some(left),
            },
            new_index_uid: match (self.new_index_uid.clone(), other.new_index_uid.clone()) {
                (None, None) => None,
                (None, Some(uid)) | (Some(uid), None) => Some(uid),
                // We should never be able to batch multiple renames at the same time.
                (Some(left), Some(_right)) => Some(left),
            },
            pre_compaction_size: match (
                self.pre_compaction_size.clone(),
                other.pre_compaction_size.clone(),
            ) {
                (None, None) => None,
                (None, Some(size)) | (Some(size), None) => Some(size),
                // We should never be able to batch multiple compactions at the same time.
                (Some(left), Some(_right)) => Some(left),
            },
            post_compaction_size: match (
                self.post_compaction_size.clone(),
                other.post_compaction_size.clone(),
            ) {
                (None, None) => None,
                (None, Some(size)) | (Some(size), None) => Some(size),
                // We should never be able to batch multiple compactions at the same time.
                (Some(left), Some(_right)) => Some(left),
            },
        }
    }
}

impl From<Details> for DetailsView {
    fn from(details: Details) -> Self {
        match details {
            Details::DocumentAdditionOrUpdate { received_documents, indexed_documents } => {
                DetailsView {
                    received_documents: Some(received_documents),
                    indexed_documents: Some(indexed_documents),
                    ..DetailsView::default()
                }
            }
            Details::DocumentEdition {
                deleted_documents,
                edited_documents,
                original_filter,
                context,
                function,
            } => DetailsView {
                deleted_documents: Some(deleted_documents),
                edited_documents: Some(edited_documents),