From 0811f47ae207f803a03472276ff9d7d23b5c9b75 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Sat, 7 Jan 2023 16:16:14 +0100 Subject: [PATCH] bug: Fix reading bundle properties Clippy's suggestion failed me, as `slice::take` only yields _at most_ the given number of elements, but `Vec::with_capacity` doesn't resize in a way that it would yield `capacity` elements. --- lib/sdk/src/bundle/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/sdk/src/bundle/mod.rs b/lib/sdk/src/bundle/mod.rs index 69267d5..1926989 100644 --- a/lib/sdk/src/bundle/mod.rs +++ b/lib/sdk/src/bundle/mod.rs @@ -88,7 +88,7 @@ impl EntryHeader { pub struct Bundle { format: BundleFormat, - properties: Vec, + properties: [Murmur64; 32], _headers: Vec, files: Vec, name: String, @@ -125,7 +125,7 @@ impl Bundle { let num_entries = r.read_u32()? as usize; - let mut properties = Vec::with_capacity(32); + let mut properties = [0.into(); 32]; for prop in properties.iter_mut().take(32) { *prop = Murmur64::from(r.read_u64()?); }