From 05b6480162e38fb030cfcdd76e6c75d741c9aba6 Mon Sep 17 00:00:00 2001 From: Ryan Levick Date: Mon, 27 Jun 2022 19:09:28 +0200 Subject: [PATCH] Remove unnecessary map_kind --- .../requests/submit_transaction_builder.rs | 4 +- sdk/identity/src/refresh_token.rs | 3 +- .../imds_managed_identity_credentials.rs | 1 - sdk/storage/src/core/parsing_xml.rs | 1 - sdk/storage/src/core/xml.rs | 4 +- .../src/blob/operations/put_block.rs | 10 +--- .../src/blob/operations/put_block_blob.rs | 10 +--- .../src/blob/operations/put_block_list.rs | 9 +--- .../src/blob/operations/update_page.rs | 9 +--- sdk/storage_blobs/src/container/mod.rs | 48 ++++++------------- .../src/container/operations/list_blobs.rs | 5 +- .../container/operations/list_containers.rs | 19 +++----- .../operations/file_system_get_properties.rs | 4 +- .../src/operations/file_systems_list.rs | 11 +---- .../src/clients/queue_client.rs | 7 +-- sdk/storage_queues/src/lib.rs | 2 - .../src/operations/get_messages.rs | 9 +--- .../src/operations/get_queue_acl.rs | 12 ++--- .../get_queue_service_properties.rs | 10 +--- .../src/operations/get_queue_service_stats.rs | 6 +-- .../src/operations/list_queues.rs | 9 ++-- .../src/operations/peek_messages.rs | 9 ++-- .../src/operations/put_message.rs | 10 ++-- 23 files changed, 57 insertions(+), 155 deletions(-) diff --git a/sdk/data_tables/src/requests/submit_transaction_builder.rs b/sdk/data_tables/src/requests/submit_transaction_builder.rs index d3e4b1071f..b0b54c50c4 100644 --- a/sdk/data_tables/src/requests/submit_transaction_builder.rs +++ b/sdk/data_tables/src/requests/submit_transaction_builder.rs @@ -1,7 +1,7 @@ use crate::{prelude::*, responses::*}; use azure_core::Method; use azure_core::{ - error::{Error, ErrorKind, ResultExt}, + error::{Error, ErrorKind}, prelude::*, }; use std::convert::TryInto; @@ -39,7 +39,7 @@ impl<'a> SubmitTransactionBuilder<'a> { self.timeout.append_to_url_query(&mut url); - let payload = batch.to_string().map_kind(ErrorKind::DataConversion)?; + let payload = batch.to_string()?; let mut request = self.partition_key_client.prepare_request( url.as_str(), diff --git a/sdk/identity/src/refresh_token.rs b/sdk/identity/src/refresh_token.rs index 0b33151dee..aa7b12f4bd 100644 --- a/sdk/identity/src/refresh_token.rs +++ b/sdk/identity/src/refresh_token.rs @@ -57,8 +57,7 @@ pub async fn exchange( } else { return Err( ErrorKind::http_response_from_body(rsp_status.as_u16(), &rsp_body).into_error(), - ) - .map_kind(ErrorKind::Credential); + ); } } diff --git a/sdk/identity/src/token_credentials/imds_managed_identity_credentials.rs b/sdk/identity/src/token_credentials/imds_managed_identity_credentials.rs index 3de8836dcd..8bf582ff4c 100644 --- a/sdk/identity/src/token_credentials/imds_managed_identity_credentials.rs +++ b/sdk/identity/src/token_credentials/imds_managed_identity_credentials.rs @@ -142,7 +142,6 @@ impl TokenCredential for ImdsManagedIdentityCredential { return Err( ErrorKind::http_response_from_body(rsp_status, &rsp_body).into_error() ) - .map_kind(ErrorKind::Credential) } } } diff --git a/sdk/storage/src/core/parsing_xml.rs b/sdk/storage/src/core/parsing_xml.rs index cd6a867529..2345014b5f 100644 --- a/sdk/storage/src/core/parsing_xml.rs +++ b/sdk/storage/src/core/parsing_xml.rs @@ -56,7 +56,6 @@ pub fn traverse<'a>( let mut curnode = node; for (x, item) in path.iter().enumerate() { - let vec = find_subnodes(curnode, item); if vec.is_empty() { if (x + 1) >= path.len() && ignore_empty_leaf { diff --git a/sdk/storage/src/core/xml.rs b/sdk/storage/src/core/xml.rs index ae77142397..6002a61bbb 100644 --- a/sdk/storage/src/core/xml.rs +++ b/sdk/storage/src/core/xml.rs @@ -1,10 +1,10 @@ -use azure_core::error::{Error, ErrorKind, ResultExt}; +use azure_core::error::{ErrorKind, ResultExt}; /// The UTF8 [byte order marker](https://en.wikipedia.org/wiki/Byte_order_mark) const UTF8_BOM: [u8; 3] = [0xEF, 0xBB, 0xBF]; /// Reads the XML from bytes. -pub fn read_xml<'de, T: serde::de::Deserialize<'de>>(body: &[u8]) -> Result { +pub fn read_xml<'de, T: serde::de::Deserialize<'de>>(body: &[u8]) -> azure_core::Result { serde_xml_rs::from_reader(slice_bom(body)) .context(ErrorKind::DataConversion, "failed to deserialize xml") } diff --git a/sdk/storage_blobs/src/blob/operations/put_block.rs b/sdk/storage_blobs/src/blob/operations/put_block.rs index 482cca4d02..1276757265 100644 --- a/sdk/storage_blobs/src/blob/operations/put_block.rs +++ b/sdk/storage_blobs/src/blob/operations/put_block.rs @@ -1,10 +1,5 @@ use crate::prelude::*; -use azure_core::{ - error::{ErrorKind, ResultExt}, - headers::*, - prelude::*, - RequestId, -}; +use azure_core::{headers::*, prelude::*, RequestId}; use azure_storage::{headers::consistency_from_headers, ConsistencyCRC64, ConsistencyMD5}; use bytes::Bytes; use chrono::{DateTime, Utc}; @@ -74,8 +69,7 @@ pub struct PutBlockResponse { impl PutBlockResponse { pub(crate) fn from_headers(headers: &Headers) -> azure_core::Result { - let (content_md5, content_crc64) = - consistency_from_headers(headers).map_kind(ErrorKind::DataConversion)?; + let (content_md5, content_crc64) = consistency_from_headers(headers)?; let request_id = request_id_from_headers(headers)?; let date = date_from_headers(headers)?; let request_server_encrypted = request_server_encrypted_from_headers(headers)?; diff --git a/sdk/storage_blobs/src/blob/operations/put_block_blob.rs b/sdk/storage_blobs/src/blob/operations/put_block_blob.rs index adfa19c0a7..c2af7a391f 100644 --- a/sdk/storage_blobs/src/blob/operations/put_block_blob.rs +++ b/sdk/storage_blobs/src/blob/operations/put_block_blob.rs @@ -1,10 +1,5 @@ use crate::prelude::*; -use azure_core::{ - error::{ErrorKind, ResultExt}, - headers::*, - prelude::*, - RequestId, -}; +use azure_core::{headers::*, prelude::*, RequestId}; use azure_storage::{headers::consistency_from_headers, ConsistencyCRC64, ConsistencyMD5}; use bytes::Bytes; use chrono::{DateTime, Utc}; @@ -105,8 +100,7 @@ impl PutBlockBlobResponse { pub fn from_headers(headers: &Headers) -> azure_core::Result { let etag = etag_from_headers(headers)?; let last_modified = last_modified_from_headers(headers)?; - let (content_md5, content_crc64) = - consistency_from_headers(headers).map_kind(ErrorKind::DataConversion)?; + let (content_md5, content_crc64) = consistency_from_headers(headers)?; let request_id = request_id_from_headers(headers)?; let date = date_from_headers(headers)?; let request_server_encrypted = request_server_encrypted_from_headers(headers)?; diff --git a/sdk/storage_blobs/src/blob/operations/put_block_list.rs b/sdk/storage_blobs/src/blob/operations/put_block_list.rs index 0ee933f314..44935fd1b3 100644 --- a/sdk/storage_blobs/src/blob/operations/put_block_list.rs +++ b/sdk/storage_blobs/src/blob/operations/put_block_list.rs @@ -1,10 +1,5 @@ use crate::prelude::*; -use azure_core::{ - error::{ErrorKind, ResultExt}, - headers::*, - prelude::*, - RequestId, -}; +use azure_core::{headers::*, prelude::*, RequestId}; use azure_storage::{headers::content_md5_from_headers, ConsistencyMD5}; use bytes::Bytes; use chrono::{DateTime, Utc}; @@ -115,7 +110,7 @@ impl PutBlockListResponse { pub(crate) fn from_headers(headers: &Headers) -> azure_core::Result { let etag = etag_from_headers(headers)?; let last_modified = last_modified_from_headers(headers)?; - let content_md5 = content_md5_from_headers(headers).map_kind(ErrorKind::DataConversion)?; + let content_md5 = content_md5_from_headers(headers)?; let request_id = request_id_from_headers(headers)?; let date = date_from_headers(headers)?; let request_server_encrypted = request_server_encrypted_from_headers(headers)?; diff --git a/sdk/storage_blobs/src/blob/operations/update_page.rs b/sdk/storage_blobs/src/blob/operations/update_page.rs index 916099849d..676e5afc0e 100644 --- a/sdk/storage_blobs/src/blob/operations/update_page.rs +++ b/sdk/storage_blobs/src/blob/operations/update_page.rs @@ -1,10 +1,5 @@ use crate::{prelude::*, BA512Range}; -use azure_core::{ - error::{ErrorKind, ResultExt}, - headers::*, - prelude::*, - RequestId, -}; +use azure_core::{headers::*, prelude::*, RequestId}; use azure_storage::{headers::content_md5_from_headers, ConsistencyMD5}; use bytes::Bytes; use chrono::{DateTime, Utc}; @@ -93,7 +88,7 @@ impl UpdatePageResponse { pub(crate) fn from_headers(headers: &Headers) -> azure_core::Result { let etag = etag_from_headers(headers)?; let last_modified = last_modified_from_headers(headers)?; - let content_md5 = content_md5_from_headers(headers).map_kind(ErrorKind::DataConversion)?; + let content_md5 = content_md5_from_headers(headers)?; let sequence_number = sequence_number_from_headers(headers)?; let request_id = request_id_from_headers(headers)?; let date = date_from_headers(headers)?; diff --git a/sdk/storage_blobs/src/container/mod.rs b/sdk/storage_blobs/src/container/mod.rs index 6839a75f66..03646f5bea 100644 --- a/sdk/storage_blobs/src/container/mod.rs +++ b/sdk/storage_blobs/src/container/mod.rs @@ -124,39 +124,19 @@ impl Container { } fn parse(elem: &Element) -> azure_core::Result { - let name = cast_must::(elem, &["Name"]).map_kind(ErrorKind::DataConversion)?; - let last_modified = cast_must::>(elem, &["Properties", "Last-Modified"]) - .map_kind(ErrorKind::DataConversion)?; - let e_tag = cast_must::(elem, &["Properties", "Etag"]) - .map_kind(ErrorKind::DataConversion)?; - - let lease_state = cast_must::(elem, &["Properties", "LeaseState"]) - .map_kind(ErrorKind::DataConversion)?; - - let lease_duration = cast_optional::(elem, &["Properties", "LeaseDuration"]) - .map_kind(ErrorKind::DataConversion)?; - - let lease_status = cast_must::(elem, &["Properties", "LeaseStatus"]) - .map_kind(ErrorKind::DataConversion)?; - + let name = cast_must(elem, &["Name"]).map_kind(ErrorKind::DataConversion)?; + let last_modified = cast_must(elem, &["Properties", "Last-Modified"])?; + let e_tag = cast_must(elem, &["Properties", "Etag"])?; + let lease_state = cast_must(elem, &["Properties", "LeaseState"])?; + let lease_duration = cast_optional(elem, &["Properties", "LeaseDuration"])?; + let lease_status = cast_must(elem, &["Properties", "LeaseStatus"])?; let public_access = - match cast_optional::(elem, &["Properties", "PublicAccess"]) - .map_kind(ErrorKind::DataConversion)? - { - Some(pa) => pa, - None => PublicAccess::None, - }; - - let has_immutability_policy = - cast_must::(elem, &["Properties", "HasImmutabilityPolicy"]) - .map_kind(ErrorKind::DataConversion)?; - let has_legal_hold = cast_must::(elem, &["Properties", "HasLegalHold"]) - .map_kind(ErrorKind::DataConversion)?; - + cast_optional(elem, &["Properties", "PublicAccess"])?.unwrap_or(PublicAccess::None); + let has_immutability_policy = cast_must(elem, &["Properties", "HasImmutabilityPolicy"])?; + let has_legal_hold = cast_must(elem, &["Properties", "HasLegalHold"])?; let metadata = { let mut hm = HashMap::new(); - let metadata = - traverse(elem, &["Metadata"], true).map_kind(ErrorKind::DataConversion)?; + let metadata = traverse(elem, &["Metadata"], true)?; for m in metadata { for key in &m.children { @@ -170,8 +150,6 @@ impl Container { } }; - let key = elem.name.to_owned(); - if elem.children.is_empty() { return Err(Error::message( ErrorKind::DataConversion, @@ -179,9 +157,11 @@ impl Container { )); } + let key = elem.name.clone(); + let content = { - match elem.children[0] { - Xml::CharacterNode(ref content) => content.to_owned(), + match &elem.children[0] { + Xml::CharacterNode(content) => content.clone(), _ => { return Err(Error::message(ErrorKind::DataConversion, "Metadata node should contain a CharacterNode with metadata value", diff --git a/sdk/storage_blobs/src/container/operations/list_blobs.rs b/sdk/storage_blobs/src/container/operations/list_blobs.rs index 642f12140c..32e3d6a386 100644 --- a/sdk/storage_blobs/src/container/operations/list_blobs.rs +++ b/sdk/storage_blobs/src/container/operations/list_blobs.rs @@ -2,7 +2,7 @@ use crate::{blob::Blob, prelude::*}; use azure_core::Method; use azure_core::{ collect_pinned_stream, - error::{Error, ErrorKind, ResultExt}, + error::Error, headers::{date_from_headers, request_id_from_headers}, prelude::*, Pageable, RequestId, Response as AzureResponse, @@ -166,8 +166,7 @@ impl ListBlobsResponse { let (_, headers, body) = response.deconstruct(); let body = collect_pinned_stream(body).await?; - let list_blobs_response_internal: ListBlobsResponseInternal = - read_xml(&body).map_kind(ErrorKind::DataConversion)?; + let list_blobs_response_internal: ListBlobsResponseInternal = read_xml(&body)?; let next_marker = match list_blobs_response_internal.next_marker { Some(ref nm) if nm.is_empty() => None, diff --git a/sdk/storage_blobs/src/container/operations/list_containers.rs b/sdk/storage_blobs/src/container/operations/list_containers.rs index 2d099b27da..3c76002cbe 100644 --- a/sdk/storage_blobs/src/container/operations/list_containers.rs +++ b/sdk/storage_blobs/src/container/operations/list_containers.rs @@ -96,25 +96,20 @@ pub struct ListContainersResponse { impl ListContainersResponse { async fn try_from(response: Response) -> azure_core::Result { - let body = response.into_body().await; - let body = std::str::from_utf8(&body)?; - + let body = response.into_body_string().await; let elem: Element = body.parse().map_kind(ErrorKind::Other)?; let mut containers = Vec::new(); - for container in - traverse(&elem, &["Containers", "Container"], true).map_kind(ErrorKind::Other)? - { + for container in traverse(&elem, &["Containers", "Container"], true)? { containers.push(Container::parse(container)?); } - let next_marker = - match cast_optional::(&elem, &["NextMarker"]).map_kind(ErrorKind::Other)? { - Some(ref nm) if nm.is_empty() => None, - Some(nm) => Some(nm), - None => None, - }; + let next_marker = match cast_optional::(&elem, &["NextMarker"])? { + Some(nm) if nm.is_empty() => None, + Some(nm) => Some(nm), + None => None, + }; Ok(Self { containers, diff --git a/sdk/storage_datalake/src/operations/file_system_get_properties.rs b/sdk/storage_datalake/src/operations/file_system_get_properties.rs index ac47639b88..4b0c83a42d 100644 --- a/sdk/storage_datalake/src/operations/file_system_get_properties.rs +++ b/sdk/storage_datalake/src/operations/file_system_get_properties.rs @@ -1,8 +1,6 @@ use crate::clients::FileSystemClient; use crate::{util::*, Properties}; -use azure_core::error::ResultExt; use azure_core::{ - error::ErrorKind, headers::{etag_from_headers, last_modified_from_headers}, AppendToUrlQuery, Etag, Response as HttpResponse, }; @@ -79,7 +77,7 @@ impl GetFileSystemPropertiesResponse { etag: Etag::from(etag_from_headers(&headers)?), last_modified: last_modified_from_headers(&headers)?, namespace_enabled: namespace_enabled_from_headers(&headers)?, - properties: (&headers).try_into().map_kind(ErrorKind::DataConversion)?, + properties: (&headers).try_into()?, }) } } diff --git a/sdk/storage_datalake/src/operations/file_systems_list.rs b/sdk/storage_datalake/src/operations/file_systems_list.rs index d946a677d6..57cfdc14b2 100644 --- a/sdk/storage_datalake/src/operations/file_systems_list.rs +++ b/sdk/storage_datalake/src/operations/file_systems_list.rs @@ -1,12 +1,6 @@ use crate::clients::DataLakeClient; use crate::file_system::{FileSystem, FileSystemList}; -use azure_core::error::ResultExt; -use azure_core::{ - collect_pinned_stream, - error::{Error, ErrorKind}, - prelude::*, - Pageable, Response, -}; +use azure_core::{collect_pinned_stream, error::Error, prelude::*, Pageable, Response}; use azure_core::{AppendToUrlQuery, Request}; use azure_storage::core::headers::CommonStorageResponseHeaders; use std::convert::TryInto; @@ -94,8 +88,7 @@ impl ListFileSystemsResponse { pub(crate) async fn try_from(response: Response) -> azure_core::Result { let (_status_code, headers, pinned_stream) = response.deconstruct(); let body = collect_pinned_stream(pinned_stream).await?; - let file_system_list: FileSystemList = - body.try_into().map_kind(ErrorKind::DataConversion)?; + let file_system_list: FileSystemList = body.try_into()?; Ok(ListFileSystemsResponse { common_storage_response_headers: (&headers).try_into()?, diff --git a/sdk/storage_queues/src/clients/queue_client.rs b/sdk/storage_queues/src/clients/queue_client.rs index 7bd46f397e..4b317503fb 100644 --- a/sdk/storage_queues/src/clients/queue_client.rs +++ b/sdk/storage_queues/src/clients/queue_client.rs @@ -1,9 +1,5 @@ use crate::{operations::*, QueueStoredAccessPolicy}; -use azure_core::{ - error::{ErrorKind, ResultExt}, - prelude::*, - Context, Request, Response, -}; +use azure_core::{prelude::*, Context, Request, Response}; use azure_storage::core::clients::{ AsStorageClient, ServiceType, StorageAccountClient, StorageClient, }; @@ -59,7 +55,6 @@ impl QueueClient { { self.storage_client .queue_url_with_segments(Some(self.queue_name.as_str()).into_iter().chain(segments)) - .map_kind(ErrorKind::DataConversion) } pub fn queue_name(&self) -> &str { diff --git a/sdk/storage_queues/src/lib.rs b/sdk/storage_queues/src/lib.rs index 05687d3096..4d4830c30d 100644 --- a/sdk/storage_queues/src/lib.rs +++ b/sdk/storage_queues/src/lib.rs @@ -1,6 +1,4 @@ #[macro_use] -extern crate log; -#[macro_use] extern crate serde_derive; #[macro_use] extern crate azure_core; diff --git a/sdk/storage_queues/src/operations/get_messages.rs b/sdk/storage_queues/src/operations/get_messages.rs index 29cfe8effc..2fe3c3be06 100644 --- a/sdk/storage_queues/src/operations/get_messages.rs +++ b/sdk/storage_queues/src/operations/get_messages.rs @@ -1,10 +1,5 @@ use crate::{clients::QueueClient, prelude::*, PopReceipt}; -use azure_core::{ - collect_pinned_stream, - error::{ErrorKind, ResultExt}, - prelude::*, - Context, Method, Response as AzureResponse, -}; +use azure_core::{collect_pinned_stream, prelude::*, Context, Method, Response as AzureResponse}; use azure_storage::core::{headers::CommonStorageResponseHeaders, xml::read_xml}; use chrono::{DateTime, Utc}; use serde::Deserialize; @@ -115,7 +110,7 @@ struct MessageList { impl GetMessagesResponse { fn parse_messages(body: &[u8]) -> azure_core::Result> { - let response: MessageList = read_xml(body).map_kind(ErrorKind::DataConversion)?; + let response: MessageList = read_xml(body)?; Ok(response.messages.unwrap_or_default()) } diff --git a/sdk/storage_queues/src/operations/get_queue_acl.rs b/sdk/storage_queues/src/operations/get_queue_acl.rs index 32068d03ce..39045efcfa 100644 --- a/sdk/storage_queues/src/operations/get_queue_acl.rs +++ b/sdk/storage_queues/src/operations/get_queue_acl.rs @@ -1,10 +1,5 @@ use crate::{clients::QueueClient, QueueStoredAccessPolicy}; -use azure_core::{ - collect_pinned_stream, - error::{ErrorKind, ResultExt}, - prelude::*, - Context, Method, Response as AzureResponse, -}; +use azure_core::{collect_pinned_stream, prelude::*, Context, Method, Response as AzureResponse}; use azure_storage::{core::headers::CommonStorageResponseHeaders, StoredAccessPolicyList}; use std::convert::TryInto; @@ -75,11 +70,10 @@ impl GetQueueACLResponse { let body = collect_pinned_stream(body).await?; let a: azure_core::Result> = - StoredAccessPolicyList::from_xml(&body) - .map_kind(ErrorKind::DataConversion)? + StoredAccessPolicyList::from_xml(&body)? .stored_access .into_iter() - .map(|sap| sap.try_into().map_kind(ErrorKind::DataConversion)) + .map(|sap| sap.try_into()) .collect(); Ok(GetQueueACLResponse { diff --git a/sdk/storage_queues/src/operations/get_queue_service_properties.rs b/sdk/storage_queues/src/operations/get_queue_service_properties.rs index 682b295b4b..db0cd4a582 100644 --- a/sdk/storage_queues/src/operations/get_queue_service_properties.rs +++ b/sdk/storage_queues/src/operations/get_queue_service_properties.rs @@ -1,10 +1,5 @@ use crate::{QueueServiceClient, QueueServiceProperties}; -use azure_core::{ - collect_pinned_stream, - error::{ErrorKind, ResultExt}, - prelude::*, - Context, Method, Response as AzureResponse, -}; +use azure_core::{collect_pinned_stream, prelude::*, Context, Method, Response as AzureResponse}; use azure_storage::core::{headers::CommonStorageResponseHeaders, xml::read_xml}; use std::convert::TryInto; @@ -81,8 +76,7 @@ impl GetQueueServicePropertiesResponse { let (_, headers, body) = response.deconstruct(); let body = collect_pinned_stream(body).await?; - let queue_service_properties: QueueServiceProperties = - read_xml(&body).map_kind(ErrorKind::DataConversion)?; + let queue_service_properties: QueueServiceProperties = read_xml(&body)?; Ok(GetQueueServicePropertiesResponse { common_storage_response_headers: (&headers).try_into()?, diff --git a/sdk/storage_queues/src/operations/get_queue_service_stats.rs b/sdk/storage_queues/src/operations/get_queue_service_stats.rs index cfd87a4b00..1c66ccb246 100644 --- a/sdk/storage_queues/src/operations/get_queue_service_stats.rs +++ b/sdk/storage_queues/src/operations/get_queue_service_stats.rs @@ -104,11 +104,7 @@ impl GetQueueServiceStatsResponse { let (_, headers, body) = response.deconstruct(); let body = collect_pinned_stream(body).await?; - debug!("headers == {:?}", headers); - debug!("body == {:#?}", body); - let response: GetQueueServiceStatsResponseInternal = - read_xml(&body).map_kind(ErrorKind::DataConversion)?; - debug!("deserde == {:#?}", response); + let response: GetQueueServiceStatsResponseInternal = read_xml(&body)?; Ok(GetQueueServiceStatsResponse { common_storage_response_headers: (&headers).try_into()?, diff --git a/sdk/storage_queues/src/operations/list_queues.rs b/sdk/storage_queues/src/operations/list_queues.rs index 950ded297a..d164702657 100644 --- a/sdk/storage_queues/src/operations/list_queues.rs +++ b/sdk/storage_queues/src/operations/list_queues.rs @@ -1,9 +1,7 @@ use crate::QueueServiceClient; use azure_core::{ - collect_pinned_stream, - error::{Error, ErrorKind, ResultExt}, - prelude::*, - Context, Method, Pageable, Response as AzureResponse, + collect_pinned_stream, error::Error, prelude::*, Context, Method, Pageable, + Response as AzureResponse, }; use azure_storage::{core::headers::CommonStorageResponseHeaders, xml::read_xml}; use std::convert::TryInto; @@ -140,8 +138,7 @@ impl ListQueuesResponse { let (_, headers, body) = response.deconstruct(); let body = collect_pinned_stream(body).await?; - let mut response: ListQueuesResponseInternal = - read_xml(&body).map_kind(ErrorKind::DataConversion)?; + let mut response: ListQueuesResponseInternal = read_xml(&body)?; // get rid of the ugly Some("") empty string // we use None instead diff --git a/sdk/storage_queues/src/operations/peek_messages.rs b/sdk/storage_queues/src/operations/peek_messages.rs index b68c8aca9d..12d485fd26 100644 --- a/sdk/storage_queues/src/operations/peek_messages.rs +++ b/sdk/storage_queues/src/operations/peek_messages.rs @@ -1,10 +1,7 @@ use crate::{clients::QueueClient, prelude::*}; use azure_core::{ - collect_pinned_stream, - error::{ErrorKind, ResultExt}, - headers::utc_date_from_rfc2822, - prelude::*, - Context, Method, Response as AzureResponse, + collect_pinned_stream, headers::utc_date_from_rfc2822, prelude::*, Context, Method, + Response as AzureResponse, }; use azure_storage::core::{headers::CommonStorageResponseHeaders, xml::read_xml}; use chrono::{DateTime, Utc}; @@ -108,7 +105,7 @@ impl PeekMessagesResponse { let (_, headers, body) = response.deconstruct(); let body = collect_pinned_stream(body).await?; - let response: PeekMessagesInternal = read_xml(&body).map_kind(ErrorKind::DataConversion)?; + let response: PeekMessagesInternal = read_xml(&body)?; let mut messages = Vec::new(); for message in response.messages.unwrap_or_default().into_iter() { diff --git a/sdk/storage_queues/src/operations/put_message.rs b/sdk/storage_queues/src/operations/put_message.rs index c0f6e79f0a..5d4c6a195a 100644 --- a/sdk/storage_queues/src/operations/put_message.rs +++ b/sdk/storage_queues/src/operations/put_message.rs @@ -1,10 +1,7 @@ use crate::prelude::*; use azure_core::{ - collect_pinned_stream, - error::{ErrorKind, ResultExt}, - headers::utc_date_from_rfc2822, - prelude::*, - Context, Method, Response as AzureResponse, + collect_pinned_stream, headers::utc_date_from_rfc2822, prelude::*, Context, Method, + Response as AzureResponse, }; use azure_storage::{core::headers::CommonStorageResponseHeaders, xml::read_xml}; use chrono::{DateTime, Utc}; @@ -121,8 +118,7 @@ impl PutMessageResponse { let (_, headers, body) = response.deconstruct(); let body = collect_pinned_stream(body).await?; - let response: PutMessageResponseInternal = - read_xml(&body).map_kind(ErrorKind::DataConversion)?; + let response: PutMessageResponseInternal = read_xml(&body)?; let queue_message = response.queue_message; let queue_message = QueueMessage {