From e6734528f00e3c7916cc8ba6f0412008eba442b8 Mon Sep 17 00:00:00 2001 From: pwbh <127856937+pwbh@users.noreply.github.com> Date: Thu, 1 Feb 2024 18:59:14 +0200 Subject: [PATCH] don't use magical numbers --- nyx-storage/src/lib.rs | 2 +- nyx-storage/src/offset.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nyx-storage/src/lib.rs b/nyx-storage/src/lib.rs index e5d15e5..912b064 100644 --- a/nyx-storage/src/lib.rs +++ b/nyx-storage/src/lib.rs @@ -232,7 +232,7 @@ mod tests { #[async_std::test] #[cfg_attr(miri, ignore)] async fn get_returns_ok() { - let message_count = 1_000_000; + let message_count = 500; let test_message = b"messssagee"; let mut storage = setup_test_storage(&function!(), test_message, message_count).await; diff --git a/nyx-storage/src/offset.rs b/nyx-storage/src/offset.rs index c260962..fa5cda4 100644 --- a/nyx-storage/src/offset.rs +++ b/nyx-storage/src/offset.rs @@ -39,7 +39,7 @@ impl Offset { } pub fn as_bytes(&self) -> &[u8] { - let offset = self as *const _ as *const [u8; 32]; + let offset = self as *const _ as *const [u8; std::mem::size_of::()]; unsafe { &(*offset) } }