]> git.lizzy.rs Git - rust.git/commitdiff
Remove unneeded `loop`.
authorCorey Farwell <coreyf@rwell.org>
Thu, 14 Sep 2017 02:44:14 +0000 (22:44 -0400)
committerCorey Farwell <coreyf@rwell.org>
Thu, 14 Sep 2017 02:44:14 +0000 (22:44 -0400)
src/liballoc/btree/set.rs

index d32460da9392342e12834e28d1e5684956297b0a..7da6371cc19072dd94e001a317ebe107c6d4a46c 100644 (file)
@@ -1110,15 +1110,13 @@ impl<'a, T: Ord> Iterator for Union<'a, T> {
     type Item = &'a T;
 
     fn next(&mut self) -> Option<&'a T> {
-        loop {
-            match cmp_opt(self.a.peek(), self.b.peek(), Greater, Less) {
-                Less => return self.a.next(),
-                Equal => {
-                    self.b.next();
-                    return self.a.next();
-                }
-                Greater => return self.b.next(),
+        match cmp_opt(self.a.peek(), self.b.peek(), Greater, Less) {
+            Less => self.a.next(),
+            Equal => {
+                self.b.next();
+                self.a.next()
             }
+            Greater => self.b.next(),
         }
     }