diff --git a/.cargo/config.toml b/.cargo/config.toml index dfe0a638..4b014006 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,25 +1,2 @@ [alias] xtask = "run --manifest-path xtask/Cargo.toml --" - -[target.'cfg(all(target_os = "linux", target_arch = "aarch64"))'] -runner = "qemu-aarch64" # May need to remove this if targeting AArch64 from an AArch64 Linux box - -[target.aarch64-unknown-linux-gnu] -linker = "aarch64-linux-gnu-gcc" - -[target.aarch64-unknown-linux-musl] -linker = "aarch64-linux-musl-gcc" -# AArch64 Linux musl targets are repeatedly affected under varying -# circumstances by fixedn't linking issues to compiler builtin symbols. -# Linking to libgcc, though arguably an inelegant hack that's only portable -# to our glibc from musl crosscompilation scenario, is effective to reliably -# provide an implementation of those fundamental symbols over time, without -# user-visible impacts on the final executables. See: -# https://github.com/rust-lang/rust/issues/46651 -# https://github.com/rust-lang/compiler-builtins/issues/201 -# https://github.com/rust-lang/rust/issues/128401 (the issue most relevant to -# our observed failures) -# Note that these flags are not enforced on CI because CI overrides them through -# the RUSTFLAG environment variable. Check out the CI workflow definition file at -# .github/workflows/oxipng.yml for more info -rustflags = ["-Clink-args=-lgcc"] diff --git a/.github/workflows/oxipng.yml b/.github/workflows/oxipng.yml index 0d555dcb..e653b658 100644 --- a/.github/workflows/oxipng.yml +++ b/.github/workflows/oxipng.yml @@ -33,16 +33,16 @@ jobs: include: - target: x86_64-unknown-linux-gnu - os: ubuntu-22.04 + os: ubuntu-24.04 target-apt-arch: amd64 - target: x86_64-unknown-linux-musl - os: ubuntu-22.04 + os: ubuntu-24.04 target-apt-arch: amd64 - target: aarch64-unknown-linux-gnu - os: ubuntu-22.04 + os: ubuntu-24.04-arm target-apt-arch: arm64 - target: aarch64-unknown-linux-musl - os: ubuntu-22.04 + os: ubuntu-24.04-arm target-apt-arch: arm64 - target: x86_64-pc-windows-msvc os: windows-latest @@ -51,13 +51,11 @@ jobs: - target: x86_64-apple-darwin os: macos-13 # x86_64 runner - target: aarch64-apple-darwin - os: macos-14 # ARM64 runner + os: macos-15 # ARM64 runner env: CARGO_BUILD_TARGET: ${{ matrix.target }} - # Hopefully temporary workaround for https://github.com/rust-lang/rust/issues/128401 - # See the comments for similar rustflag settings at .cargo/config.toml for more context - RUSTFLAGS: ${{ matrix.target == 'aarch64-unknown-linux-musl' && '-Zlocation-detail=none -Clink-args=-lgcc' || '-Zlocation-detail=none' }} + RUSTFLAGS: '-Zlocation-detail=none' steps: - name: Checkout source @@ -65,32 +63,12 @@ jobs: with: persist-credentials: false - - name: Set up Ubuntu multiarch - if: startsWith(matrix.os, 'ubuntu') && matrix.target-apt-arch != 'amd64' - run: | - readonly DISTRO_CODENAME=jammy - sudo dpkg --add-architecture "${{ matrix.target-apt-arch }}" - sudo sed -i "s/^deb http/deb [arch=$(dpkg-architecture -q DEB_HOST_ARCH)] http/" /etc/apt/sources.list - sudo sed -i "s/^deb mirror/deb [arch=$(dpkg-architecture -q DEB_HOST_ARCH)] mirror/" /etc/apt/sources.list - for suite in '' '-updates' '-backports' '-security'; do - echo "deb [arch=${{ matrix.target-apt-arch }}] http://ports.ubuntu.com/ $DISTRO_CODENAME$suite main universe multiverse" | \ - sudo tee -a /etc/apt/sources.list >/dev/null - done - - name: Install musl development files if: endsWith(matrix.target, '-musl') run: | sudo apt-get -yq update sudo apt-get -yq install musl-tools musl-dev:${{ matrix.target-apt-arch }} - - name: Install QEMU and AArch64 cross compiler - if: startsWith(matrix.target, 'aarch64-unknown-linux') - run: | - sudo apt-get -yq update - # libc6 must be present to run executables dynamically linked - # against glibc for the target architecture - sudo apt-get -yq install qemu-user gcc-aarch64-linux-gnu libc6:arm64 - - name: Install Rust toolchain uses: actions-rust-lang/setup-rust-toolchain@v1 with: @@ -183,7 +161,7 @@ jobs: - name: Install MSRV Rust toolchain uses: actions-rust-lang/setup-rust-toolchain@v1 with: - toolchain: 1.74.0 + toolchain: 1.85.1 cache-bin: false cache-shared-key: cache diff --git a/Cargo.lock b/Cargo.lock index c1351e37..511c0a69 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,18 +1,18 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "adler2" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" [[package]] name = "anstream" -version = "0.6.18" +version = "0.6.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" +checksum = "3ae563653d1938f79b1ab1b5e668c87c76a9930414574a6583a7b7e11a8e6192" dependencies = [ "anstyle", "anstyle-parse", @@ -25,44 +25,44 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" +checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd" [[package]] name = "anstyle-parse" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.1.2" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" +checksum = "9e231f6134f61b71076a3eab506c379d4f36122f2af15a9ff04415ea4c3339e2" dependencies = [ "windows-sys", ] [[package]] name = "anstyle-wincon" -version = "3.0.7" +version = "3.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e" +checksum = "3e0633414522a32ffaac8ac6cc8f748e090c5717661fddeea04219e2344f5f2a" dependencies = [ "anstyle", - "once_cell", + "once_cell_polyfill", "windows-sys", ] [[package]] name = "autocfg" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" [[package]] name = "bitflags" @@ -72,9 +72,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.9.0" +version = "2.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" +checksum = "34efbcccd345379ca2868b2b2c9d3782e9cc58ba87bc7d79d5b53d9c9ae6f25d" [[package]] name = "bitvec" @@ -90,15 +90,15 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.17.0" +version = "3.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" +checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" [[package]] name = "bytemuck" -version = "1.22.0" +version = "1.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6b1fc10dbac614ebc03540c9dbd60e83887fda27794998c6528f1782047d540" +checksum = "3995eaeebcdf32f91f980d360f78732ddc061097ab4e39991ae7a6ace9194677" [[package]] name = "byteorder-lite" @@ -108,33 +108,33 @@ checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" [[package]] name = "cc" -version = "1.2.19" +version = "1.2.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e3a13707ac958681c13b39b458c073d0d9bc8a22cb1b2f4c8e55eb72c13f362" +checksum = "42bc4aea80032b7bf409b0bc7ccad88853858911b7713a8062fdc0623867bedc" dependencies = [ "shlex", ] [[package]] name = "cfg-if" -version = "1.0.0" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" [[package]] name = "clap" -version = "4.5.43" +version = "4.5.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50fd97c9dc2399518aa331917ac6f274280ec5eb34e555dd291899745c48ec6f" +checksum = "1fc0e74a703892159f5ae7d3aac52c8e6c392f5ae5f359c70b5881d60aaac318" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.5.43" +version = "4.5.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c35b5830294e1fa0462034af85cc95225a4cb07092c088c55bda3147cfcd8f65" +checksum = "b3e7f4214277f3c7aa526a59dd3fbe306a370daee1f8b7b8c987069cd8e888a8" dependencies = [ "anstream", "anstyle", @@ -145,21 +145,21 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" +checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675" [[package]] name = "colorchoice" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" [[package]] name = "crc32fast" -version = "1.4.2" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" dependencies = [ "cfg-if", ] @@ -233,9 +233,9 @@ checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] name = "errno" -version = "0.3.11" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "976dd42dc7e85965fe702eb8164f21f450704bdde31faefd6471dba214cb594e" +checksum = "778e2ac28f6c47af28e4907f13ffd1e1ddbd400980a9abd7c8df189bf578a5ad" dependencies = [ "libc", "windows-sys", @@ -252,9 +252,9 @@ dependencies = [ [[package]] name = "filetime" -version = "0.2.25" +version = "0.2.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35c0522e981e68cbfa8c3f978441a5f34b30b96e146b33cd3359176b50fe8586" +checksum = "bc0505cd1b6fa6580283f6bdf70a73fcf4aba1184038c90902b92b3dd0df63ed" dependencies = [ "cfg-if", "libc", @@ -264,9 +264,9 @@ dependencies = [ [[package]] name = "flate2" -version = "1.1.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ced92e76e966ca2fd84c8f7aa01a4aea65b0eb6648d72f7c8f3e2764a67fece" +checksum = "4a3d7db9596fecd151c5f638c0ee5d5bd487b6e0ea232e5dc96d5250f6f94b1d" dependencies = [ "crc32fast", "miniz_oxide", @@ -286,9 +286,9 @@ checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" [[package]] name = "hashbrown" -version = "0.15.2" +version = "0.15.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" [[package]] name = "image" @@ -304,9 +304,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.10.0" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661" +checksum = "f2481980430f9f78649238835720ddccc57e52df14ffce1c6f37391d61b563e9" dependencies = [ "equivalent", "hashbrown", @@ -321,9 +321,9 @@ checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" [[package]] name = "libc" -version = "0.2.172" +version = "0.2.175" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" +checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543" [[package]] name = "libdeflate-sys" @@ -346,11 +346,11 @@ dependencies = [ [[package]] name = "libredox" -version = "0.1.3" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" +checksum = "391290121bad3d37fbddad76d8f5d1c1c314cfc646d143d7e07a3086ddff0ce3" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.3", "libc", "redox_syscall", ] @@ -369,9 +369,9 @@ checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" [[package]] name = "miniz_oxide" -version = "0.8.8" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3be647b768db090acb35d5ec5db2b0e1f1de11133ca123b9eacf5137868f892a" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" dependencies = [ "adler2", "simd-adler32", @@ -387,10 +387,10 @@ dependencies = [ ] [[package]] -name = "once_cell" -version = "1.21.3" +name = "once_cell_polyfill" +version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" [[package]] name = "oxipng" @@ -439,9 +439,9 @@ checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" [[package]] name = "rayon" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" +checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" dependencies = [ "either", "rayon-core", @@ -449,9 +449,9 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.12.1" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" dependencies = [ "crossbeam-deque", "crossbeam-utils", @@ -459,11 +459,11 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.11" +version = "0.5.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2f103c6d277498fbceb16e84d317e2a400f160f46904d5f5410848c829511a3" +checksum = "5407465600fb0548f1442edf71dd20683c6ed326200ace4b1ef0763521bb3b77" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.3", ] [[package]] @@ -483,11 +483,11 @@ checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" [[package]] name = "rustix" -version = "1.0.5" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d97817398dd4bb2e6da002002db259209759911da105da92bec29ccb12cf58bf" +checksum = "11181fbabf243db407ef8df94a6ce0b2f9a733bd8be4ad02b4eda9602296cac8" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.3", "errno", "libc", "linux-raw-sys", @@ -520,9 +520,9 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "terminal_size" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45c6481c4829e4cc63825e62c49186a34538b7b2750b73b266581ffb612fb5ed" +checksum = "60b8cb979cb11c32ce1603f8137b22262a9d131aaa5c37b5678025f22b8becd0" dependencies = [ "rustix", "windows-sys", @@ -535,20 +535,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] -name = "windows-sys" -version = "0.59.0" +name = "windows-link" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" + +[[package]] +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" dependencies = [ "windows-targets", ] [[package]] name = "windows-targets" -version = "0.52.6" +version = "0.53.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91" dependencies = [ + "windows-link", "windows_aarch64_gnullvm", "windows_aarch64_msvc", "windows_i686_gnu", @@ -561,51 +568,51 @@ dependencies = [ [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.6" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" [[package]] name = "windows_aarch64_msvc" -version = "0.52.6" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" [[package]] name = "windows_i686_gnu" -version = "0.52.6" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" +checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" [[package]] name = "windows_i686_gnullvm" -version = "0.52.6" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" [[package]] name = "windows_i686_msvc" -version = "0.52.6" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" [[package]] name = "windows_x86_64_gnu" -version = "0.52.6" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.6" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" [[package]] name = "windows_x86_64_msvc" -version = "0.52.6" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" [[package]] name = "wyz" diff --git a/Cargo.toml b/Cargo.toml index 387508b0..6f6d8826 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ categories = ["command-line-utilities", "compression"] description = "A lossless PNG compression optimizer" keywords = ["png", "image-compression", "optimization", "multi-threading", "lossless"] documentation = "https://docs.rs/oxipng" -edition = "2021" +edition = "2024" exclude = [ ".editorconfig", ".gitattributes", @@ -21,7 +21,7 @@ license = "MIT" name = "oxipng" repository = "https://github.com/oxipng/oxipng" version = "9.1.5" -rust-version = "1.74.0" +rust-version = "1.85.1" [badges] travis-ci = { repository = "oxipng/oxipng", branch = "master" } diff --git a/Dockerfile b/Dockerfile index c8e27bab..fc5a2fd2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ # check=error=true FROM --platform=$BUILDPLATFORM tonistiigi/xx AS xx -FROM --platform=$BUILDPLATFORM rust:1.74-alpine AS base +FROM --platform=$BUILDPLATFORM rust:1.85.1-alpine AS base RUN apk update && \ apk add \ diff --git a/README.md b/README.md index 10b855ce..9c41e644 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ cargo build --release cp target/release/oxipng /usr/local/bin ``` -The current minimum supported Rust version is **1.74.0**. +The current minimum supported Rust version is **1.85.1**. Oxipng follows Semantic Versioning. diff --git a/benches/zopfli.rs b/benches/zopfli.rs index 912782fe..345a71ab 100644 --- a/benches/zopfli.rs +++ b/benches/zopfli.rs @@ -8,8 +8,7 @@ use std::{num::NonZeroU8, path::PathBuf}; use oxipng::{internal_tests::*, *}; use test::Bencher; -// SAFETY: trivially safe. Stopgap solution until const unwrap is stabilized. -const DEFAULT_ZOPFLI_ITERATIONS: NonZeroU8 = unsafe { NonZeroU8::new_unchecked(15) }; +const DEFAULT_ZOPFLI_ITERATIONS: NonZeroU8 = NonZeroU8::new(15).unwrap(); #[bench] fn zopfli_16_bits_strategy_0(b: &mut Bencher) { diff --git a/src/apng.rs b/src/apng.rs index 8b99d0f1..b2817e1e 100644 --- a/src/apng.rs +++ b/src/apng.rs @@ -1,9 +1,9 @@ use std::io::Write; use crate::{ + PngResult, error::PngError, headers::{read_be_u16, read_be_u32}, - PngResult, }; #[derive(Debug, Clone)] diff --git a/src/atomicmin.rs b/src/atomicmin.rs index 57303e6d..e01163f4 100644 --- a/src/atomicmin.rs +++ b/src/atomicmin.rs @@ -15,11 +15,7 @@ impl AtomicMin { pub fn get(&self) -> Option { let val = self.val.load(SeqCst); - if val == usize::MAX { - None - } else { - Some(val) - } + if val == usize::MAX { None } else { Some(val) } } /// Try a new value, returning true if it is the new minimum diff --git a/src/cli.rs b/src/cli.rs index 2d6f729a..800da204 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -1,6 +1,6 @@ use std::path::PathBuf; -use clap::{value_parser, Arg, ArgAction, Command}; +use clap::{Arg, ArgAction, Command, value_parser}; include!("display_chunks.rs"); diff --git a/src/evaluate.rs b/src/evaluate.rs index f15aaed9..af6c4070 100644 --- a/src/evaluate.rs +++ b/src/evaluate.rs @@ -4,12 +4,12 @@ #[cfg(not(feature = "parallel"))] use std::cell::RefCell; use std::sync::{ - atomic::{AtomicUsize, Ordering::*}, Arc, + atomic::{AtomicUsize, Ordering::*}, }; #[cfg(feature = "parallel")] -use crossbeam_channel::{unbounded, Receiver, Sender}; +use crossbeam_channel::{Receiver, Sender, unbounded}; use deflate::Deflaters; use indexmap::IndexSet; use log::trace; @@ -17,7 +17,7 @@ use rayon::prelude::*; #[cfg(not(feature = "parallel"))] use crate::rayon; -use crate::{atomicmin::AtomicMin, deflate, filters::RowFilter, png::PngImage, Deadline, PngError}; +use crate::{Deadline, PngError, atomicmin::AtomicMin, deflate, filters::RowFilter, png::PngImage}; pub(crate) struct Candidate { pub image: Arc, @@ -30,7 +30,7 @@ pub(crate) struct Candidate { } impl Candidate { - fn cmp_key(&self) -> impl Ord { + fn cmp_key(&self) -> impl Ord + use<> { ( self.estimated_output_size, self.image.data.len(), @@ -161,10 +161,7 @@ impl Evaluator { best_candidate_size.set_min(estimated_output_size); trace!( "Eval: {}-bit {:23} {:8} {} bytes", - image.ihdr.bit_depth, - description, - filter, - estimated_output_size + image.ihdr.bit_depth, description, filter, estimated_output_size ); #[cfg(feature = "parallel")] @@ -182,10 +179,7 @@ impl Evaluator { } else if let Err(PngError::DeflatedDataTooLong(size)) = idat_data { trace!( "Eval: {}-bit {:23} {:8} >{} bytes", - image.ihdr.bit_depth, - description, - filter, - size + image.ihdr.bit_depth, description, filter, size ); } }); diff --git a/src/headers.rs b/src/headers.rs index 21786d4d..db48f15b 100644 --- a/src/headers.rs +++ b/src/headers.rs @@ -3,12 +3,12 @@ use log::{debug, trace, warn}; use rgb::{RGB16, RGBA8}; use crate::{ + Deflaters, Options, PngResult, colors::{BitDepth, ColorType}, deflate::{crc32, inflate}, display_chunks::DISPLAY_CHUNKS, error::PngError, interlace::Interlacing, - Deflaters, Options, PngResult, }; #[derive(Debug, Clone)] diff --git a/src/interlace.rs b/src/interlace.rs index 07af3b1e..7b4f2f5e 100644 --- a/src/interlace.rs +++ b/src/interlace.rs @@ -2,7 +2,7 @@ use std::{fmt, fmt::Display}; use bitvec::prelude::*; -use crate::{headers::IhdrData, png::PngImage, PngError}; +use crate::{PngError, headers::IhdrData, png::PngImage}; /// Whether to enable progressive rendering. See [`Options`][crate::Options]) #[repr(u8)] diff --git a/src/lib.rs b/src/lib.rs index c3d6dba0..1af2e8e3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -27,16 +27,16 @@ mod rayon; use std::{ fs::{File, Metadata}, - io::{stdin, stdout, BufWriter, Read, Write}, + io::{BufWriter, Read, Write, stdin, stdout}, path::Path, sync::{ - atomic::{AtomicBool, Ordering}, Arc, + atomic::{AtomicBool, Ordering}, }, time::{Duration, Instant}, }; -pub use indexmap::{indexset, IndexSet}; +pub use indexmap::{IndexSet, indexset}; use log::{debug, info, trace, warn}; use rayon::prelude::*; pub use rgb::{RGB16, RGBA8}; @@ -232,9 +232,9 @@ pub fn optimize(input: &InFile, output: &OutFile, opts: &Options) -> PngResult<( if is_fully_optimized(in_data.len(), optimized_output.len(), opts) { match (output, input) { - // if p is None, it also means same as the input path - (OutFile::Path { path, .. }, InFile::Path(ref input_path)) - if path.as_ref().map_or(true, |p| p == input_path) => + // If output path is None, it also means same as the input path + (OutFile::Path { path, .. }, InFile::Path(input_path)) + if path.as_ref().is_none_or(|p| p == input_path) => { info!("{input}: Could not optimize further, no change written"); return Ok(()); @@ -396,7 +396,9 @@ fn optimize_png( } if opts.interlace == Some(Interlacing::Adam7) && png.raw.ihdr.interlaced != Interlacing::Adam7 { - warn!("Interlacing was not enabled as it would result in a larger file. To override this, use `--force`."); + warn!( + "Interlacing was not enabled as it would result in a larger file. To override this, use `--force`." + ); } #[cfg(feature = "sanity-checks")] @@ -471,7 +473,7 @@ fn optimize_raw( }; if result.data_is_compressed - && max_size.map_or(true, |max_size| result.estimated_output_size < max_size) + && max_size.is_none_or(|max_size| result.estimated_output_size < max_size) { debug!("Found better result:"); debug!(" {}, f = {}", deflater, result.filter); diff --git a/src/main.rs b/src/main.rs index 52623a7d..12794f44 100644 --- a/src/main.rs +++ b/src/main.rs @@ -25,7 +25,7 @@ use std::{ use clap::ArgMatches; mod cli; use indexmap::IndexSet; -use log::{error, warn, Level, LevelFilter}; +use log::{Level, LevelFilter, error, warn}; use oxipng::{Deflaters, InFile, Options, OutFile, PngError, RowFilter, StripChunks}; use rayon::prelude::*; diff --git a/src/options.rs b/src/options.rs index b7ff717e..60353f82 100644 --- a/src/options.rs +++ b/src/options.rs @@ -4,7 +4,7 @@ use std::{ time::Duration, }; -use indexmap::{indexset, IndexSet}; +use indexmap::{IndexSet, indexset}; use log::warn; use crate::{deflate::Deflaters, filters::RowFilter, headers::StripChunks, interlace::Interlacing}; diff --git a/src/png/mod.rs b/src/png/mod.rs index a872107a..66ba002d 100644 --- a/src/png/mod.rs +++ b/src/png/mod.rs @@ -12,14 +12,14 @@ use rgb::ComponentSlice; use rustc_hash::FxHashMap; use crate::{ + Options, apng::*, colors::{BitDepth, ColorType}, deflate, error::PngError, filters::*, headers::*, - interlace::{deinterlace_image, interlace_image, Interlacing}, - Options, + interlace::{Interlacing, deinterlace_image, interlace_image}, }; pub(crate) mod scan_lines; diff --git a/src/reduction/color.rs b/src/reduction/color.rs index ddf40234..0d1dde81 100644 --- a/src/reduction/color.rs +++ b/src/reduction/color.rs @@ -1,7 +1,7 @@ use std::hash::{BuildHasherDefault, Hash}; use indexmap::IndexSet; -use rgb::{alt::Gray, ComponentMap, ComponentSlice, FromSlice, RGB, RGBA}; +use rgb::{ComponentMap, ComponentSlice, FromSlice, RGB, RGBA, alt::Gray}; use rustc_hash::FxHasher; use crate::{ diff --git a/src/reduction/mod.rs b/src/reduction/mod.rs index dc6202a1..132ae802 100644 --- a/src/reduction/mod.rs +++ b/src/reduction/mod.rs @@ -1,6 +1,6 @@ use std::sync::Arc; -use crate::{evaluate::Evaluator, png::PngImage, ColorType, Deadline, Deflaters, Options}; +use crate::{ColorType, Deadline, Deflaters, Options, evaluate::Evaluator, png::PngImage}; pub mod alpha; use crate::alpha::*; @@ -183,7 +183,7 @@ pub(crate) fn perform_reductions( if (!cheap || reduced.is_none()) && !deadline.passed() { if let Some(indexed) = indexed.and_then(|png| reduced_bit_depth_8_or_less(&png)) { // Only evaluate this if it's different from the first result (which must be grayscale if it exists) - if reduced.as_ref().map_or(true, |r| r.data != indexed.data) { + if reduced.as_ref().is_none_or(|r| r.data != indexed.data) { eval.try_image(Arc::new(indexed)); evaluation_added = true; } diff --git a/src/reduction/palette.rs b/src/reduction/palette.rs index b694b228..0d07d986 100644 --- a/src/reduction/palette.rs +++ b/src/reduction/palette.rs @@ -2,10 +2,10 @@ use indexmap::IndexSet; use rgb::RGBA8; use crate::{ + Interlacing, colors::{BitDepth, ColorType}, headers::IhdrData, - png::{scan_lines::ScanLine, PngImage}, - Interlacing, + png::{PngImage, scan_lines::ScanLine}, }; /// Attempt to reduce the number of colors in the palette, returning the reduced image if successful diff --git a/tests/flags.rs b/tests/flags.rs index ed4770cf..1ecffe63 100644 --- a/tests/flags.rs +++ b/tests/flags.rs @@ -99,11 +99,11 @@ fn test_it_converts( fn verbose_mode() { use std::cell::RefCell; #[cfg(not(feature = "parallel"))] - use std::sync::mpsc::{channel as unbounded, Sender}; + use std::sync::mpsc::{Sender, channel as unbounded}; #[cfg(feature = "parallel")] - use crossbeam_channel::{unbounded, Sender}; - use log::{set_logger, set_max_level, Level, LevelFilter, Log, Metadata, Record}; + use crossbeam_channel::{Sender, unbounded}; + use log::{Level, LevelFilter, Log, Metadata, Record, set_logger, set_max_level}; // Rust runs tests in parallel by default. // We want to make sure that we verify only logs from our test.