From 4338c8d9208a7f347b2e3d41b3cbea8a729de2ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Pereira?= Date: Wed, 1 May 2024 19:14:10 -0400 Subject: [PATCH 1/2] refactor: remove unreachable --- src/async_bin/client.rs | 1 - src/async_bin/source.rs | 3 +-- src/sync/source.rs | 5 ++--- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/async_bin/client.rs b/src/async_bin/client.rs index 34ad163..f4fa055 100644 --- a/src/async_bin/client.rs +++ b/src/async_bin/client.rs @@ -24,7 +24,6 @@ impl Client { { self.source.from_file(path).await } - /// Choose a buffer to compress. pub async fn from_buffer(self, buffer: &[u8]) -> Result { diff --git a/src/async_bin/source.rs b/src/async_bin/source.rs index 47f2eef..2aaf698 100644 --- a/src/async_bin/source.rs +++ b/src/async_bin/source.rs @@ -110,12 +110,11 @@ impl Source { serde_json::from_str(&compressed_image.text().await?)?; Err(TinifyError::ClientError { upstream }) } - StatusCode::SERVICE_UNAVAILABLE => { + _ => { let upstream: Upstream = serde_json::from_str(&compressed_image.text().await?)?; Err(TinifyError::ServerError { upstream }) } - _ => unreachable!(), } } diff --git a/src/sync/source.rs b/src/sync/source.rs index 19de791..974dd1c 100644 --- a/src/sync/source.rs +++ b/src/sync/source.rs @@ -106,12 +106,11 @@ impl Source { serde_json::from_str(&compressed_image.text()?)?; Err(TinifyError::ClientError { upstream }) } - StatusCode::SERVICE_UNAVAILABLE => { + _ => { let upstream: Upstream = serde_json::from_str(&compressed_image.text()?)?; Err(TinifyError::ServerError { upstream }) } - _ => unreachable!(), } } @@ -207,7 +206,7 @@ impl Source { Err(TinifyError::ClientError { upstream }) } } - + /// Save the current compressed image to a file. pub fn to_file

(&mut self, path: P) -> Result<(), TinifyError> where From 5bb1f1e48a1c4591aaec60b5371573c57d069f74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Pereira?= Date: Wed, 1 May 2024 19:16:40 -0400 Subject: [PATCH 2/2] chore: bump to v1.4.1 --- Cargo.toml | 2 +- README.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 37f3d3d..ad81416 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tinify-rs" -version = "1.4.0" +version = "1.4.1" edition = "2021" description = "A Rust client for the Tinify API" authors = ["The tinify-rs Developers"] diff --git a/README.md b/README.md index 2f6ccfa..c237a08 100644 --- a/README.md +++ b/README.md @@ -40,14 +40,14 @@ Install the API client with Cargo. Add this to `Cargo.toml`: ```toml [dependencies] -tinify-rs = "1.4.0" +tinify-rs = "1.4.1" ``` Using async client ```toml [dependencies] -tinify-rs = { version = "1.4.0", features = ["async"] } +tinify-rs = { version = "1.4.1", features = ["async"] } ``` ## Usage