Skip to content

Commit

Permalink
Merge pull request #9 from aldanor/feature/qoi-upstream-bump
Browse files Browse the repository at this point in the history
Update upstream libqoi, MSRV->1.62, fix clippy errors
  • Loading branch information
aldanor authored Oct 11, 2023
2 parents e97077e + 2921967 commit a8004b8
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
rust: [stable, beta, nightly, 1.61.0] # MSRV=1.61
rust: [stable, beta, nightly, 1.62.0] # MSRV=1.62
steps:
- uses: actions/checkout@v2
with: {submodules: true}
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ keywords = ["qoi", "graphics", "image", "encoding"]
exclude = [
"assets/*",
]
rust-version = "1.61.0"
rust-version = "1.62.0"

[features]
default = ["std"]
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ qoi-rust 427.4 290.0 1477.7 1002.9
```

- Reference C implementation:
[phoboslab/qoi@00e34217](https://github.com/phoboslab/qoi/commit/00e34217).
[phoboslab/qoi@8d35d93](https://github.com/phoboslab/qoi/commit/8d35d93).
- Benchmark timings were collected on an Apple M1 laptop.
- 2846 images from the suite provided upstream
([tarball](https://phoboslab.org/files/qoibench/qoi_benchmark_suite.tar)):
Expand All @@ -51,7 +51,7 @@ this library proved to be the fastest one by a noticeable margin.

### Rust version

The minimum required Rust version for the latest crate version is 1.61.0.
The minimum required Rust version for the latest crate version is 1.62.0.

### `no_std`

Expand Down
2 changes: 1 addition & 1 deletion ext/qoi
Submodule qoi updated 7 files
+21 −0 LICENSE
+22 −0 Makefile
+116 −36 README.md
+24 −46 qoi.h
+54 −94 qoibench.c
+9 −24 qoiconv.c
+4 −23 qoifuzz.c
2 changes: 1 addition & 1 deletion src/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ pub fn decode_header(data: impl AsRef<[u8]>) -> Result<Header> {
Header::decode(data)
}

#[cfg(any(feature = "std"))]
#[cfg(feature = "std")]
#[inline]
fn decode_impl_stream<R: Read, const N: usize, const RGBA: bool>(
data: &mut R, out: &mut [u8],
Expand Down
12 changes: 6 additions & 6 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,19 @@ impl Display for Error {
write!(f, "invalid magic: expected {:?}, got {:?}", QOI_MAGIC, magic.to_be_bytes())
}
Self::InvalidChannels { channels } => {
write!(f, "invalid number of channels: {}", channels)
write!(f, "invalid number of channels: {channels}")
}
Self::InvalidColorSpace { colorspace } => {
write!(f, "invalid color space: {} (expected 0 or 1)", colorspace)
write!(f, "invalid color space: {colorspace} (expected 0 or 1)")
}
Self::InvalidImageDimensions { width, height } => {
write!(f, "invalid image dimensions: {}x{}", width, height)
write!(f, "invalid image dimensions: {width}x{height}")
}
Self::InvalidImageLength { size, width, height } => {
write!(f, "invalid image length: {} bytes for {}x{}", size, width, height)
write!(f, "invalid image length: {size} bytes for {width}x{height}")
}
Self::OutputBufferTooSmall { size, required } => {
write!(f, "output buffer size too small: {} (required: {})", size, required)
write!(f, "output buffer size too small: {size} (required: {required})")
}
Self::UnexpectedBufferEnd => {
write!(f, "unexpected input buffer end while decoding")
Expand All @@ -59,7 +59,7 @@ impl Display for Error {
}
#[cfg(feature = "std")]
Self::IoError(ref err) => {
write!(f, "i/o error: {}", err)
write!(f, "i/o error: {err}")
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ impl<W: Write> GenericWriter<W> {
impl<W: Write> Writer for GenericWriter<W> {
fn write_one(mut self, v: u8) -> Result<Self> {
self.n_written += 1;
self.writer.write_all(&[v]).map(|_| self).map_err(Into::into)
self.writer.write_all(&[v]).map(|()| self).map_err(Into::into)
}

fn write_many(mut self, v: &[u8]) -> Result<Self> {
self.n_written += v.len();
self.writer.write_all(v).map(|_| self).map_err(Into::into)
self.writer.write_all(v).map(|()| self).map_err(Into::into)
}

fn capacity(&self) -> usize {
Expand Down

0 comments on commit a8004b8

Please sign in to comment.