From aaae6f1ca053c17361a66b9402f5010e81b516d9 Mon Sep 17 00:00:00 2001 From: Sunjay Varma Date: Tue, 12 May 2020 12:34:55 -0400 Subject: [PATCH] Making sure that lock guards don't get dropped right away in tests --- tokio/tests/sync_mutex.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tokio/tests/sync_mutex.rs b/tokio/tests/sync_mutex.rs index 444ebd6a22d..6107f8e22bd 100644 --- a/tokio/tests/sync_mutex.rs +++ b/tokio/tests/sync_mutex.rs @@ -47,7 +47,7 @@ fn readiness() { // But once g unlocks, we can acquire it drop(g); assert!(t2.is_woken()); - assert_ready!(t2.poll()); + let _g = assert_ready!(t2.poll()); } /* @@ -92,7 +92,7 @@ async fn aborted_future_1() { // Try to lock mutex in a future that is aborted prematurely timeout(Duration::from_millis(1u64), async move { let mut iv = interval(Duration::from_millis(1000)); - m2.lock().await; + let _g = m2.lock().await; iv.tick().await; iv.tick().await; }) @@ -101,7 +101,7 @@ async fn aborted_future_1() { } // This should succeed as there is no lock left for the mutex. timeout(Duration::from_millis(1u64), async move { - m1.lock().await; + let _g = m1.lock().await; }) .await .expect("Mutex is locked"); @@ -119,7 +119,7 @@ async fn aborted_future_2() { let m2 = m1.clone(); // Try to lock mutex in a future that is aborted prematurely timeout(Duration::from_millis(1u64), async move { - m2.lock().await; + let _g = m2.lock().await; }) .await .unwrap_err(); @@ -127,7 +127,7 @@ async fn aborted_future_2() { } // This should succeed as there is no lock left for the mutex. timeout(Duration::from_millis(1u64), async move { - m1.lock().await; + let _g = m1.lock().await; }) .await .expect("Mutex is locked");