Skip to content

Commit

Permalink
Merge pull request #14 from Danieroner/remove-unreachable
Browse files Browse the repository at this point in the history
Remove unreachable
  • Loading branch information
Danieroner authored May 1, 2024
2 parents 73d8f11 + 5bb1f1e commit 1e2c805
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"]
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/async_bin/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Source, TinifyError> {
Expand Down
3 changes: 1 addition & 2 deletions src/async_bin/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(),
}
}

Expand Down
5 changes: 2 additions & 3 deletions src/sync/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(),
}
}

Expand Down Expand Up @@ -207,7 +206,7 @@ impl Source {
Err(TinifyError::ClientError { upstream })
}
}

/// Save the current compressed image to a file.
pub fn to_file<P>(&mut self, path: P) -> Result<(), TinifyError>
where
Expand Down

0 comments on commit 1e2c805

Please sign in to comment.