aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJoel Galenson <jgalenson@google.com>2021-08-18 15:32:24 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-08-18 15:32:24 +0000
commitad3a194dd7dd726e0e1fec6cf754ccbd80242327 (patch)
treea47381fd6ef27ef61f8b74c3d071bed18d913238 /tests
parentf6d5511386f45e2912cea84bccc2b21080ae0131 (diff)
parentd5b6ee2a24468372db0905de46f73b9c26ac6b20 (diff)
downloadcrossbeam-deque-ad3a194dd7dd726e0e1fec6cf754ccbd80242327.tar.gz
Upgrade rust/crates/crossbeam-deque to 0.8.1 am: f0b1773ba1 am: 2596184eb2 am: d5b6ee2a24
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/crossbeam-deque/+/1791028 Change-Id: Idb7230aa306bf349b724a9bc8c7b177b7894831e
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);
}
}