From 75c3cb4bb6c144e38f6baf707de6bba785acb9af Mon Sep 17 00:00:00 2001 From: mpostma Date: Fri, 7 Aug 2020 17:43:35 +0200 Subject: [PATCH] fix compile error --- meilisearch-core/src/store/facets.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/meilisearch-core/src/store/facets.rs b/meilisearch-core/src/store/facets.rs index b67bca259..7436f3d65 100644 --- a/meilisearch-core/src/store/facets.rs +++ b/meilisearch-core/src/store/facets.rs @@ -44,14 +44,14 @@ impl<'a> BytesDecode<'a> for FacetData { type DItem = (&'a str, Cow<'a, Set>); fn bytes_decode(bytes: &'a [u8]) -> Option { - let len = mem::size_of::(); - let mut size_buf = [0; len]; - size_buf.copy_from_slice(bytes.get(0..len)?); + const LEN: usize = mem::size_of::(); + let mut size_buf = [0; LEN]; + size_buf.copy_from_slice(bytes.get(0..LEN)?); // decode size of the first item from the bytes let first_size = usize::from_be_bytes(size_buf); // decode first and second items - let first_item = Str::bytes_decode(bytes.get(len..(len + first_size))?)?; - let second_item = CowSet::bytes_decode(bytes.get((len + first_size)..)?)?; + let first_item = Str::bytes_decode(bytes.get(LEN..(LEN + first_size))?)?; + let second_item = CowSet::bytes_decode(bytes.get((LEN + first_size)..)?)?; Some((first_item, second_item)) } }