aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJoel Galenson <jgalenson@google.com>2021-08-09 10:27:52 -0700
committerJoel Galenson <jgalenson@google.com>2021-08-09 10:27:52 -0700
commitf0b1773ba1dd0391792ff2193b6f60cf76775031 (patch)
treea47381fd6ef27ef61f8b74c3d071bed18d913238 /tests
parentfd18f880836cd434110b749e363243fea570e8ce (diff)
downloadcrossbeam-deque-f0b1773ba1dd0391792ff2193b6f60cf76775031.tar.gz
Upgrade rust/crates/crossbeam-deque to 0.8.1
Test: make Change-Id: I59c3722da19125530542def111cb6bb457653635
Diffstat (limited to 'tests')
-rw-r--r--tests/fifo.rs20
-rw-r--r--tests/injector.rs12
-rw-r--r--tests/lifo.rs20
3 files changed, 26 insertions, 26 deletions
diff --git a/tests/fifo.rs b/tests/fifo.rs
index 19a1f58..e2365fb 100644
--- a/tests/fifo.rs
+++ b/tests/fifo.rs
@@ -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(0, 3) == 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(0, COUNT) {
- if rng.gen_range(0, 3) == 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);
}
}
diff --git a/tests/injector.rs b/tests/injector.rs
index 0165e1a..3f74d1b 100644
--- a/tests/injector.rs
+++ b/tests/injector.rs
@@ -178,7 +178,7 @@ fn stress() {
hits.fetch_add(1, SeqCst);
}
- while let Some(_) = w2.pop() {
+ while w2.pop().is_some() {
hits.fetch_add(1, SeqCst);
}
}
@@ -188,7 +188,7 @@ fn stress() {
let mut rng = rand::thread_rng();
let mut expected = 0;
while expected < COUNT {
- if rng.gen_range(0, 3) == 0 {
+ if rng.gen_range(0..3) == 0 {
while let Success(_) = q.steal() {
hits.fetch_add(1, SeqCst);
}
@@ -238,7 +238,7 @@ fn no_starvation() {
hits.fetch_add(1, SeqCst);
}
- while let Some(_) = w2.pop() {
+ while w2.pop().is_some() {
hits.fetch_add(1, SeqCst);
}
}
@@ -248,8 +248,8 @@ fn no_starvation() {
let mut rng = rand::thread_rng();
let mut my_hits = 0;
loop {
- for i in 0..rng.gen_range(0, COUNT) {
- if rng.gen_range(0, 3) == 0 && my_hits == 0 {
+ for i in 0..rng.gen_range(0..COUNT) {
+ if rng.gen_range(0..3) == 0 && my_hits == 0 {
while let Success(_) = q.steal() {
my_hits += 1;
}
@@ -311,7 +311,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);
}
diff --git a/tests/lifo.rs b/tests/lifo.rs
index d7e498a..3e99e95 100644
--- a/tests/lifo.rs
+++ b/tests/lifo.rs
@@ -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(0, 3) == 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(0, COUNT) {
- if rng.gen_range(0, 3) == 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);
}
}