From f0f7542332b2666339950c1eb782b2f3bbc9a792 Mon Sep 17 00:00:00 2001 From: eternal-flame-AD Date: Thu, 5 Sep 2024 00:22:41 -0500 Subject: [PATCH] fix indentations in macro Signed-off-by: eternal-flame-AD --- src/client.rs | 53 ++++++++++++++++++++++++++------------------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/src/client.rs b/src/client.rs index 1b68774..ca3b5ab 100644 --- a/src/client.rs +++ b/src/client.rs @@ -90,33 +90,34 @@ impl MatrixClient { match $msg { $( MessageType::$variant(file) => { - Ok(Some(Box::pin( - async move { - let src = match &file.source { - MediaSource::Plain(s) => s, - MediaSource::Encrypted(e) => &e.url, - }; - let filename = file.filename.as_deref().map(|s| s.to_string()).unwrap_or(file.body.clone()); - let url = mxc_url_to_https(src.as_str(), self.client.homeserver().as_str()); - let resp = client.get(&url).send().await?; - let body = resp.bytes_stream(); - Ok(FileStream { - filename, - url, - stream: match &file.source { - MediaSource::Plain(_) => { - Box::pin(body.map_err(DumpError::from)) as Pin> + Send>> + Ok(Some(Box::pin( + async move { + let src = match &file.source { + MediaSource::Plain(s) => s, + MediaSource::Encrypted(e) => &e.url, + }; + let filename = file.filename.as_deref().map(|s| s.to_string()).unwrap_or(file.body.clone()); + let url = mxc_url_to_https(src.as_str(), self.client.homeserver().as_str()); + let resp = client.get(&url).send().await?; + let body = resp.bytes_stream(); + Ok(FileStream { + filename, + url, + stream: match &file.source { + MediaSource::Plain(_) => { + Box::pin(body.map_err(DumpError::from)) + } + MediaSource::Encrypted(e) => Box::pin(decrypt_file(e.as_ref(), body).await?.map_ok(|v| Bytes::from(v)).map_err( + |e| match e { + ErrOrWrongHash::Err(e) => e.into(), + ErrOrWrongHash::WrongHash => DumpError::HashMismatch, + }, + )) + }}) } - MediaSource::Encrypted(e) => Box::pin(decrypt_file(e.as_ref(), body).await?.map_ok(|v| Bytes::from(v)).map_err( - |e| match e { - ErrOrWrongHash::Err(e) => e.into(), - ErrOrWrongHash::WrongHash => DumpError::HashMismatch, - }, - )) as Pin> + Send>>, - } - }) - })))} - )* + ))) + } + )* _ => Ok(None), } };