Fix compilation on 1.41.0
This commit is contained in:
parent
754133abbd
commit
2129a57532
1 changed files with 5 additions and 28 deletions
33
src/lib.rs
33
src/lib.rs
|
|
@ -12,6 +12,11 @@
|
||||||
#![warn(clippy::path_buf_push_overwrite)]
|
#![warn(clippy::path_buf_push_overwrite)]
|
||||||
#![warn(clippy::range_plus_one)]
|
#![warn(clippy::range_plus_one)]
|
||||||
#![allow(clippy::cognitive_complexity)]
|
#![allow(clippy::cognitive_complexity)]
|
||||||
|
#![cfg_attr(
|
||||||
|
not(any(feature = "libdeflater", feature = "zopfli")),
|
||||||
|
allow(irrefutable_let_patterns),
|
||||||
|
allow(unreachable_patterns)
|
||||||
|
)]
|
||||||
|
|
||||||
#[cfg(feature = "parallel")]
|
#[cfg(feature = "parallel")]
|
||||||
extern crate rayon;
|
extern crate rayon;
|
||||||
|
|
@ -219,10 +224,6 @@ impl Options {
|
||||||
// on an `Options` struct generated by the `default` method.
|
// on an `Options` struct generated by the `default` method.
|
||||||
fn apply_preset_0(mut self) -> Self {
|
fn apply_preset_0(mut self) -> Self {
|
||||||
self.idat_recoding = false;
|
self.idat_recoding = false;
|
||||||
#[cfg_attr(
|
|
||||||
not(any(feature = "zopfli", feature = "libdeflater")),
|
|
||||||
allow(irrefutable_let_patterns)
|
|
||||||
)]
|
|
||||||
if let Deflaters::Zlib { compression, .. } = &mut self.deflate {
|
if let Deflaters::Zlib { compression, .. } = &mut self.deflate {
|
||||||
compression.clear();
|
compression.clear();
|
||||||
compression.insert(3);
|
compression.insert(3);
|
||||||
|
|
@ -232,10 +233,6 @@ impl Options {
|
||||||
|
|
||||||
fn apply_preset_1(mut self) -> Self {
|
fn apply_preset_1(mut self) -> Self {
|
||||||
self.filter.clear();
|
self.filter.clear();
|
||||||
#[cfg_attr(
|
|
||||||
not(any(feature = "zopfli", feature = "libdeflater")),
|
|
||||||
allow(irrefutable_let_patterns)
|
|
||||||
)]
|
|
||||||
if let Deflaters::Zlib { strategies, .. } = &mut self.deflate {
|
if let Deflaters::Zlib { strategies, .. } = &mut self.deflate {
|
||||||
strategies.clear();
|
strategies.clear();
|
||||||
}
|
}
|
||||||
|
|
@ -259,10 +256,6 @@ impl Options {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn apply_preset_5(mut self) -> Self {
|
fn apply_preset_5(mut self) -> Self {
|
||||||
#[cfg_attr(
|
|
||||||
not(any(feature = "zopfli", feature = "libdeflater")),
|
|
||||||
allow(irrefutable_let_patterns)
|
|
||||||
)]
|
|
||||||
if let Deflaters::Zlib { compression, .. } = &mut self.deflate {
|
if let Deflaters::Zlib { compression, .. } = &mut self.deflate {
|
||||||
compression.clear();
|
compression.clear();
|
||||||
for i in 3..9 {
|
for i in 3..9 {
|
||||||
|
|
@ -273,10 +266,6 @@ impl Options {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn apply_preset_6(mut self) -> Self {
|
fn apply_preset_6(mut self) -> Self {
|
||||||
#[cfg_attr(
|
|
||||||
not(any(feature = "zopfli", feature = "libdeflater")),
|
|
||||||
allow(irrefutable_let_patterns)
|
|
||||||
)]
|
|
||||||
if let Deflaters::Zlib { compression, .. } = &mut self.deflate {
|
if let Deflaters::Zlib { compression, .. } = &mut self.deflate {
|
||||||
compression.clear();
|
compression.clear();
|
||||||
for i in 1..3 {
|
for i in 1..3 {
|
||||||
|
|
@ -479,10 +468,6 @@ fn optimize_png(
|
||||||
info!(" File size = {} bytes", file_original_size);
|
info!(" File size = {} bytes", file_original_size);
|
||||||
|
|
||||||
let mut filter = opts.filter.clone();
|
let mut filter = opts.filter.clone();
|
||||||
#[cfg_attr(
|
|
||||||
not(any(feature = "zopfli", feature = "libdeflater")),
|
|
||||||
allow(unreachable_patterns)
|
|
||||||
)]
|
|
||||||
let mut strategies = match &opts.deflate {
|
let mut strategies = match &opts.deflate {
|
||||||
Deflaters::Zlib { strategies, .. } => Some(strategies.clone()),
|
Deflaters::Zlib { strategies, .. } => Some(strategies.clone()),
|
||||||
_ => None,
|
_ => None,
|
||||||
|
|
@ -524,10 +509,6 @@ fn optimize_png(
|
||||||
|
|
||||||
if opts.idat_recoding || reduction_occurred {
|
if opts.idat_recoding || reduction_occurred {
|
||||||
// Go through selected permutations and determine the best
|
// Go through selected permutations and determine the best
|
||||||
#[cfg_attr(
|
|
||||||
not(any(feature = "zopfli", feature = "libdeflater")),
|
|
||||||
allow(irrefutable_let_patterns)
|
|
||||||
)]
|
|
||||||
let combinations = if let Deflaters::Zlib { compression, .. } = &opts.deflate {
|
let combinations = if let Deflaters::Zlib { compression, .. } = &opts.deflate {
|
||||||
filter.len() * compression.len() * strategies.as_ref().unwrap().len()
|
filter.len() * compression.len() * strategies.as_ref().unwrap().len()
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -536,10 +517,6 @@ fn optimize_png(
|
||||||
let mut results: Vec<TrialOptions> = Vec::with_capacity(combinations);
|
let mut results: Vec<TrialOptions> = Vec::with_capacity(combinations);
|
||||||
|
|
||||||
for f in &filter {
|
for f in &filter {
|
||||||
#[cfg_attr(
|
|
||||||
not(any(feature = "zopfli", feature = "libdeflater")),
|
|
||||||
allow(irrefutable_let_patterns)
|
|
||||||
)]
|
|
||||||
if let Deflaters::Zlib { compression, .. } = &opts.deflate {
|
if let Deflaters::Zlib { compression, .. } = &opts.deflate {
|
||||||
for zc in compression {
|
for zc in compression {
|
||||||
for zs in strategies.as_ref().unwrap() {
|
for zs in strategies.as_ref().unwrap() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue