From 07c3e42bd7c21be29227646dfce465cb57827465 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 14 Jul 2022 08:13:24 -0400 Subject: [PATCH] replace a macro by a function --- tests/pass/weak_memory/weak.rs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/tests/pass/weak_memory/weak.rs b/tests/pass/weak_memory/weak.rs index 1d82b85844f4..5e2e78882de5 100644 --- a/tests/pass/weak_memory/weak.rs +++ b/tests/pass/weak_memory/weak.rs @@ -72,7 +72,7 @@ fn seq_cst() -> bool { fn initialization_write() -> bool { let x = static_atomic(11); - assert_eq!(x.load(Relaxed), 11); + assert_eq!(x.load(Relaxed), 11); // work around https://github.com/rust-lang/miri/issues/2164 let wait = static_atomic(0); @@ -94,15 +94,13 @@ fn initialization_write() -> bool { r2 == 11 } -// Asserts that the function returns true at least once in 100 runs -macro_rules! assert_once { - ($f:ident) => { - assert!(std::iter::repeat_with(|| $f()).take(100).any(|x| x)); - }; +/// Asserts that the function returns true at least once in 100 runs +fn assert_once(f: fn() -> bool) { + assert!(std::iter::repeat_with(|| f()).take(100).any(|x| x)); } pub fn main() { - assert_once!(relaxed); - assert_once!(seq_cst); - assert_once!(initialization_write); + assert_once(relaxed); + assert_once(seq_cst); + assert_once(initialization_write); }