diff --git a/crates/storage/src/lazy/lazy_array.rs b/crates/storage/src/lazy/lazy_array.rs index 3464300dfa5..27ed2b9f4e7 100644 --- a/crates/storage/src/lazy/lazy_array.rs +++ b/crates/storage/src/lazy/lazy_array.rs @@ -215,12 +215,22 @@ impl<'a, T> DoubleEndedIterator for EntriesIter<'a, T> { impl<'a, T> ExactSizeIterator for EntriesIter<'a, T> {} +use std::convert::TryInto; impl EntryArray { /// Creates a new entry array cache. pub fn new() -> Self { + let entries = + std::iter::repeat_with(|| Default::default()) + .take(N) + .collect::>>>>() + .try_into(); + let entries = match entries { + Ok(entries) => entries, + Err(_) => unreachable!("f"), + }; Self { - entries: [(); N].map(|_|Default::default()) + entries } } } diff --git a/crates/storage/src/lib.rs b/crates/storage/src/lib.rs index 91357473d98..62d93313c14 100644 --- a/crates/storage/src/lib.rs +++ b/crates/storage/src/lib.rs @@ -20,7 +20,6 @@ //! FFI to interface with SRML contracts and a primitive blockchain //! emulator for simple off-chain testing. -#![feature(array_map)] #![feature(array_methods)] #![feature(min_const_generics)]