From 3453b08bc71852e5d567fe2bebce1f4244ea4c7b Mon Sep 17 00:00:00 2001 From: tuxuser <462620+tuxuser@users.noreply.github.com> Date: Fri, 4 Oct 2024 11:08:49 +0200 Subject: [PATCH] fix(clippy): Minor code smells --- src/error.rs | 2 +- src/extensions.rs | 2 +- src/flows.rs | 2 +- src/models.rs | 2 ++ src/request_signer.rs | 1 + src/tokenstore.rs | 2 ++ 6 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/error.rs b/src/error.rs index 495574d..5ed1aea 100644 --- a/src/error.rs +++ b/src/error.rs @@ -51,7 +51,7 @@ pub enum Error { /// Target HTTP url url: String, /// HTTP headers - headers: http::HeaderMap, + headers: Box, /// HTTP message body body: String, /// [`serde_json`] error diff --git a/src/extensions.rs b/src/extensions.rs index 28d0de3..02fa5fc 100644 --- a/src/extensions.rs +++ b/src/extensions.rs @@ -172,7 +172,7 @@ impl JsonExDeserializeMiddleware for reqwest::Response { let res = serde_json::from_slice::(&full).map_err(|e| Error::JsonHttpResponseError { status: http_status, url: url.to_string(), - headers, + headers: Box::new(headers), body: String::from_utf8_lossy(&full).to_string(), inner: e, }); diff --git a/src/flows.rs b/src/flows.rs index 236fec6..351c98a 100644 --- a/src/flows.rs +++ b/src/flows.rs @@ -391,7 +391,7 @@ impl Flows { /// Shorthand for Windows Live authorization flow /// - Depending on the argument `implicit` the - /// methods `implicit grant` or `authorization code` are chosen + /// methods `implicit grant` or `authorization code` are chosen /// /// # Examples /// diff --git a/src/models.rs b/src/models.rs index 7fee916..0f56570 100644 --- a/src/models.rs +++ b/src/models.rs @@ -446,6 +446,7 @@ pub enum AccessTokenPrefix { None, } +#[allow(clippy::to_string_trait_impl)] impl ToString for AccessTokenPrefix { fn to_string(&self) -> String { let prefix = match self { @@ -488,6 +489,7 @@ impl FromStr for DeviceType { } } +#[allow(clippy::to_string_trait_impl)] impl ToString for DeviceType { fn to_string(&self) -> String { let str = match self { diff --git a/src/request_signer.rs b/src/request_signer.rs index 6872e98..271c775 100644 --- a/src/request_signer.rs +++ b/src/request_signer.rs @@ -84,6 +84,7 @@ impl From> for XboxWebSignatureBytes { } } +#[allow(clippy::to_string_trait_impl)] impl ToString for XboxWebSignatureBytes { fn to_string(&self) -> String { let bytes: Vec = self.into(); diff --git a/src/tokenstore.rs b/src/tokenstore.rs index 0f1de92..1377e68 100644 --- a/src/tokenstore.rs +++ b/src/tokenstore.rs @@ -48,6 +48,7 @@ impl From for XalAuthenticator { } } +#[allow(clippy::to_string_trait_impl)] impl ToString for TokenStore { fn to_string(&self) -> String { serde_json::to_string(&self).expect("Failed to serialize TokenStore") @@ -142,6 +143,7 @@ impl TokenStore { .read(true) .write(true) .create(true) + .truncate(true) .open(filepath)?; file.rewind()?;