Skip to content

Commit

Permalink
Merge pull request #314 from eth3lbert/flate2-precise
Browse files Browse the repository at this point in the history
Adjust `Level::Precise` clamp range for flate2
  • Loading branch information
NobodyXu authored Nov 23, 2024
2 parents e12ca46 + 0b83b1a commit 8844733
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ impl Level {
fn into_flate2(self) -> flate2::Compression {
let fastest = flate2::Compression::fast();
let best = flate2::Compression::best();
let none = flate2::Compression::none();

match self {
Self::Fastest => fastest,
Expand All @@ -224,7 +225,7 @@ impl Level {
quality
.try_into()
.unwrap_or(0)
.clamp(fastest.level(), best.level()),
.clamp(none.level(), best.level()),
),
Self::Default => flate2::Compression::default(),
}
Expand Down

0 comments on commit 8844733

Please sign in to comment.