From 1d5bd7009e4a8272301b5f67d285d539aa327a16 Mon Sep 17 00:00:00 2001 From: Islam El-Ashi Date: Wed, 20 Sep 2023 14:46:49 +0300 Subject: [PATCH] . --- src/btreemap/node.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/btreemap/node.rs b/src/btreemap/node.rs index 7b89c19d..28ee7bdd 100644 --- a/src/btreemap/node.rs +++ b/src/btreemap/node.rs @@ -71,17 +71,15 @@ impl Node { let header: NodeHeader = read_struct(address, memory); assert_eq!(&header.magic, MAGIC, "Bad magic."); match header.version { - LAYOUT_VERSION_1 => { - if let PageSize::Derived(DerivedPageSize { + LAYOUT_VERSION_1 => match page_size { + PageSize::Derived(DerivedPageSize { max_key_size, max_value_size, - }) = page_size - { - Self::load_v1(header, address, max_key_size, max_value_size, memory) - } else { + }) => Self::load_v1(header, address, max_key_size, max_value_size, memory), + PageSize::Value(_) => { unreachable!("Tried to load a V1 node without a derived PageSize.") } - } + }, LAYOUT_VERSION_2 => Self::load_v2(address, page_size, header, memory), unknown_version => unreachable!("Unsupported version {unknown_version}."), }