From 4a6344de4f81fb15c2c33e856ef2a02c40908cd9 Mon Sep 17 00:00:00 2001 From: Devon Sawatsky Date: Sun, 22 Oct 2023 00:10:50 -0700 Subject: convert a optional match into ? --- gifed/src/gif.rs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/gifed/src/gif.rs b/gifed/src/gif.rs index 1c71d13..90354a1 100644 --- a/gifed/src/gif.rs +++ b/gifed/src/gif.rs @@ -64,16 +64,12 @@ impl<'a> Iterator for ImageIterator<'a> { let starting_block = self.block_index; let img = loop { - match self.gif.blocks.get(self.block_index) { - Some(block) => { - if let Block::CompressedImage(img) = block { - // Step over this image so we don't hit it next time - self.block_index += 1; - - break img; - } - } - None => return None, + let block = self.gif.blocks.get(self.block_index)?; + if let Block::CompressedImage(img) = block { + // Step over this image so we don't hit it next time + self.block_index += 1; + + break img; } self.block_index += 1; -- cgit 1.4.1-3-g733a5