From 05f397e4deac9bbfe9421d379956ad343f4ae718 Mon Sep 17 00:00:00 2001
From: Jon Gjengset <jon@thesquareplanet.com>
Date: Sun, 26 Apr 2020 11:56:00 -0400
Subject: [PATCH] Use preferred miri cfg pattern

---
 src/lib.rs   |  4 +++-
 tests/lib.rs | 12 ++++++------
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/lib.rs b/src/lib.rs
index 249a389..88ead38 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -290,7 +290,9 @@ impl<T> Bus<T> {
         });
 
         // work around https://github.com/rust-lang/rust/issues/59020
-        let _ = time::Instant::now().elapsed();
+        if !cfg!(miri) && cfg!(target = "macos") {
+            let _ = time::Instant::now().elapsed();
+        }
 
         // we run a separate thread responsible for unparking
         // so we don't have to wait for unpark() to return in broadcast_inner
diff --git a/tests/lib.rs b/tests/lib.rs
index 811016c..072c25f 100644
--- a/tests/lib.rs
+++ b/tests/lib.rs
@@ -48,7 +48,7 @@ fn it_reads_when_full() {
 }
 
 #[test]
-#[cfg(not(miri))]
+#[cfg_attr(miri, ignore)]
 fn it_iterates() {
     use std::thread;
 
@@ -72,7 +72,7 @@ fn it_iterates() {
 }
 
 #[test]
-#[cfg(not(miri))]
+#[cfg_attr(miri, ignore)]
 fn aggressive_iteration() {
     for _ in 0..1_000 {
         use std::thread;
@@ -130,7 +130,7 @@ fn it_handles_leaves() {
 }
 
 #[test]
-#[cfg(not(miri))]
+#[cfg_attr(miri, ignore)]
 fn it_runs_blocked_writes() {
     use std::thread;
 
@@ -152,7 +152,7 @@ fn it_runs_blocked_writes() {
 }
 
 #[test]
-#[cfg(not(miri))]
+#[cfg_attr(miri, ignore)]
 fn it_runs_blocked_reads() {
     use std::sync::mpsc;
     use std::thread;
@@ -172,7 +172,7 @@ fn it_runs_blocked_reads() {
 }
 
 #[test]
-#[cfg(not(miri))]
+#[cfg_attr(miri, ignore)]
 fn it_can_count_to_10000() {
     use std::thread;
 
@@ -193,7 +193,7 @@ fn it_can_count_to_10000() {
 }
 
 #[test]
-#[cfg(not(miri))]
+#[cfg_attr(miri, ignore)]
 fn test_busy() {
     use std::thread;