Skip to content

Commit 0b83b1a

Browse files
committed
Adjust Level::Precise clamp range for flate2
Previously, the clamp range was from "fastest" to "best" (1-9). This commit changes the range to start from "none" (0) to allow for no compression.
1 parent e12ca46 commit 0b83b1a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ impl Level {
216216
fn into_flate2(self) -> flate2::Compression {
217217
let fastest = flate2::Compression::fast();
218218
let best = flate2::Compression::best();
219+
let none = flate2::Compression::none();
219220

220221
match self {
221222
Self::Fastest => fastest,
@@ -224,7 +225,7 @@ impl Level {
224225
quality
225226
.try_into()
226227
.unwrap_or(0)
227-
.clamp(fastest.level(), best.level()),
228+
.clamp(none.level(), best.level()),
228229
),
229230
Self::Default => flate2::Compression::default(),
230231
}

0 commit comments

Comments
 (0)