diff --git a/fake/src/impls/std/array.rs b/fake/src/impls/std/array.rs index 6639dc6..968cd98 100644 --- a/fake/src/impls/std/array.rs +++ b/fake/src/impls/std/array.rs @@ -1,26 +1,11 @@ use crate::{Dummy, Fake}; use rand::Rng; -macro_rules! array_impl { - {$n:expr, $t:ident $($ts:ident)*} => { - impl Dummy for [T; $n] where T: Dummy { - fn dummy_with_rng(config: &U, rng: &mut R) -> Self { - [Fake::fake_with_rng::<$t, _>(config, rng), $(Fake::fake_with_rng::<$ts, _>(config, rng)),*] - } - } - array_impl!{($n - 1), $($ts)*} - }; - {$n:expr,} => { - impl Dummy for [T; $n] where T: Dummy { - fn dummy(_: &U) -> Self { - [] - } - - fn dummy_with_rng(_: &U, _rng: &mut R) -> Self { - [] - } - } - }; +impl Dummy for [T; N] +where + T: Dummy, +{ + fn dummy_with_rng(config: &U, rng: &mut R) -> Self { + std::array::from_fn(|_| Fake::fake_with_rng::(config, rng)) + } } - -array_impl! {32, T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T}