about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDevon Sawatsky <novedevo@gmail.com>2023-10-22 00:10:50 -0700
committerDevon Sawatsky <novedevo@gmail.com>2023-10-22 00:10:50 -0700
commit4a6344de4f81fb15c2c33e856ef2a02c40908cd9 (patch)
treeb6469765747d31b8aa33810f387d93236a6c2826
parent2628856cf6e1b0d9c2e2ac87d1ae9d3ff716a47f (diff)
downloadgifed-4a6344de4f81fb15c2c33e856ef2a02c40908cd9.tar.gz
gifed-4a6344de4f81fb15c2c33e856ef2a02c40908cd9.zip
convert a optional match into ?
-rw-r--r--gifed/src/gif.rs16
1 files 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;