about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/libcore/iter/adapters/chain.rs15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/libcore/iter/adapters/chain.rs b/src/libcore/iter/adapters/chain.rs
index 6c97c43df40..0100e62fae6 100644
--- a/src/libcore/iter/adapters/chain.rs
+++ b/src/libcore/iter/adapters/chain.rs
@@ -62,12 +62,15 @@ where
     #[inline]
     #[rustc_inherit_overflow_checks]
     fn count(self) -> usize {
-        match self {
-            Chain { a: Some(a), b: Some(b) } => a.count() + b.count(),
-            Chain { a: Some(a), b: None } => a.count(),
-            Chain { a: None, b: Some(b) } => b.count(),
-            Chain { a: None, b: None } => 0,
-        }
+        let a_count = match self.a {
+            Some(a) => a.count(),
+            None => 0,
+        };
+        let b_count = match self.b {
+            Some(b) => b.count(),
+            None => 0,
+        };
+        a_count + b_count
     }
 
     fn try_fold<Acc, F, R>(&mut self, mut acc: Acc, mut f: F) -> R