Don't use unstable language features

This commit is contained in:
Andrew 2023-04-21 13:07:14 +12:00 committed by Josh Holmer
parent b09f7f353c
commit 184a2a6b32

View file

@ -18,9 +18,10 @@ pub(crate) use crate::bit_depth::reduce_bit_depth;
/// Attempt to reduce the number of colors in the palette /// Attempt to reduce the number of colors in the palette
/// Returns `None` if palette hasn't changed /// Returns `None` if palette hasn't changed
pub fn reduced_palette(png: &PngImage, optimize_alpha: bool) -> Option<PngImage> { pub fn reduced_palette(png: &PngImage, optimize_alpha: bool) -> Option<PngImage> {
let ColorType::Indexed { palette } = &png.ihdr.color_type else { let palette = match &png.ihdr.color_type {
ColorType::Indexed { palette } => palette,
// Can't reduce if there is no palette // Can't reduce if there is no palette
return None; _ => return None,
}; };
if png.ihdr.bit_depth == BitDepth::One { if png.ihdr.bit_depth == BitDepth::One {
// Gains from 1-bit images will be at most 1 byte // Gains from 1-bit images will be at most 1 byte