From 184a2a6b32c8f38bf20186f1737e592164d584c0 Mon Sep 17 00:00:00 2001 From: Andrew Date: Fri, 21 Apr 2023 13:07:14 +1200 Subject: [PATCH] Don't use unstable language features --- src/reduction/mod.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/reduction/mod.rs b/src/reduction/mod.rs index f540b7dd..8154189c 100644 --- a/src/reduction/mod.rs +++ b/src/reduction/mod.rs @@ -18,9 +18,10 @@ pub(crate) use crate::bit_depth::reduce_bit_depth; /// Attempt to reduce the number of colors in the palette /// Returns `None` if palette hasn't changed pub fn reduced_palette(png: &PngImage, optimize_alpha: bool) -> Option { - 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 - return None; + _ => return None, }; if png.ihdr.bit_depth == BitDepth::One { // Gains from 1-bit images will be at most 1 byte