]> git.proxmox.com Git - rustc.git/blobdiff - vendor/crossbeam-deque/tests/lifo.rs
New upstream version 1.56.0~beta.4+dfsg1
[rustc.git] / vendor / crossbeam-deque / tests / lifo.rs
index d7e498add9b783e6f3ac27705db8daabe9285f4b..3e99e95c5e86ac40e19385f218bc3270643593d4 100644 (file)
@@ -167,7 +167,7 @@ fn stress() {
                         hits.fetch_add(1, SeqCst);
                     }
 
-                    while let Some(_) = w2.pop() {
+                    while w2.pop().is_some() {
                         hits.fetch_add(1, SeqCst);
                     }
                 }
@@ -177,8 +177,8 @@ fn stress() {
         let mut rng = rand::thread_rng();
         let mut expected = 0;
         while expected < COUNT {
-            if rng.gen_range(03) == 0 {
-                while let Some(_) = w.pop() {
+            if rng.gen_range(0..3) == 0 {
+                while w.pop().is_some() {
                     hits.fetch_add(1, SeqCst);
                 }
             } else {
@@ -188,7 +188,7 @@ fn stress() {
         }
 
         while hits.load(SeqCst) < COUNT {
-            while let Some(_) = w.pop() {
+            while w.pop().is_some() {
                 hits.fetch_add(1, SeqCst);
             }
         }
@@ -227,7 +227,7 @@ fn no_starvation() {
                         hits.fetch_add(1, SeqCst);
                     }
 
-                    while let Some(_) = w2.pop() {
+                    while w2.pop().is_some() {
                         hits.fetch_add(1, SeqCst);
                     }
                 }
@@ -237,9 +237,9 @@ fn no_starvation() {
         let mut rng = rand::thread_rng();
         let mut my_hits = 0;
         loop {
-            for i in 0..rng.gen_range(0COUNT) {
-                if rng.gen_range(03) == 0 && my_hits == 0 {
-                    while let Some(_) = w.pop() {
+            for i in 0..rng.gen_range(0..COUNT) {
+                if rng.gen_range(0..3) == 0 && my_hits == 0 {
+                    while w.pop().is_some() {
                         my_hits += 1;
                     }
                 } else {
@@ -300,7 +300,7 @@ fn destructors() {
                         remaining.fetch_sub(1, SeqCst);
                     }
 
-                    while let Some(_) = w2.pop() {
+                    while w2.pop().is_some() {
                         cnt += 1;
                         remaining.fetch_sub(1, SeqCst);
                     }
@@ -309,7 +309,7 @@ fn destructors() {
         }
 
         for _ in 0..STEPS {
-            if let Some(_) = w.pop() {
+            if w.pop().is_some() {
                 remaining.fetch_sub(1, SeqCst);
             }
         }