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

Code before:
        self.ignore_missing_dump = ignore_missing_dump;
        self
    }
}

impl<U, I> IndexController<U, I>
where
    U: IndexMetaStore,
    I: IndexStore,
{
    pub fn builder() -> IndexControllerBuilder {
        IndexControllerBuilder::default()
    }

    pub async fn register_update(&self, uid: String, update: Update) -> Result<Task> {
        // cleaner attempts that did not compile:
        //      let index_uid = IndexUid::from_str(&uid)?;
        //      let index_uid: std::result::Result<_, IndexResolverError> = IndexUid::from_str(&uid).into()?;
        // bad implementation but compiles
        let index_uid = match IndexUid::from_str(&uid) {
            Ok(uid) => uid,
            Err(e) => {
                let e: IndexResolverError = e.into();
                Err(e)?
            }
        };

        let content = match update {
            Update::DeleteDocuments(ids) => TaskContent::DocumentDeletion {
                index_uid,
                deletion: DocumentDeletion::Ids(ids),
            },
            Update::ClearDocuments => TaskContent::DocumentDeletion {
                index_uid,
                deletion: DocumentDeletion::Clear,
            },
            Update::Settings {
                settings,
                is_deletion,
                allow_index_creation,
            } => TaskContent::SettingsUpdate {
                settings,
                is_deletion,
                allow_index_creation,
                index_uid,
            },
            Update::DocumentAddition {
                mut payload,
                primary_key,
                format,
                method,

Review comment (suggestion):
Not sure of the reason why it is struggling to infer the error type but this Should do the trick:

```suggestion
let index_uid = IndexUid::from_str(&uid).map_err(IndexResolverError::from)?;
```

Code after:
        self.ignore_missing_dump = ignore_missing_dump;
        self
    }
}

impl<U, I> IndexController<U, I>
where
    U: IndexMetaStore,
    I: IndexStore,
{
    pub fn builder() -> IndexControllerBuilder {
        IndexControllerBuilder::default()
    }

    pub async fn register_update(&self, uid: String, update: Update) -> Result<Task> {
        let index_uid = IndexUid::from_str(&uid).map_err(IndexResolverError::from)?;
        let content = match update {
            Update::DeleteDocuments(ids) => TaskContent::DocumentDeletion {
                index_uid,
                deletion: DocumentDeletion::Ids(ids),
            },
            Update::ClearDocuments => TaskContent::DocumentDeletion {
                index_uid,
                deletion: DocumentDeletion::Clear,
            },
            Update::Settings {
                settings,
                is_deletion,
                allow_index_creation,
            } => TaskContent::SettingsUpdate {
                settings,
                is_deletion,
                allow_index_creation,
                index_uid,
            },
            Update::DocumentAddition {
                mut payload,
                primary_key,
                format,
                method,
                allow_index_creation,
            } => {
                let mut buffer = Vec::new();
                while let Some(bytes) = payload.next().await {
                    let bytes = bytes?;
                    buffer.extend_from_slice(&bytes);
                }
                let (content_uuid, mut update_file) = self.update_file_store.new_update()?;
                let documents_count = tokio::task::spawn_blocking(move || -> Result<_> {
                    // check if the payload is empty, and return an error
                    if buffer.is_empty() {