changeset 559:aef949a87fc2

cargo fmt
author Lewin Bormann <lbo@spheniscida.de>
date Thu, 30 Jun 2022 21:22:29 -0700
parents a00835a29ec7
children 06d6eaa2168d
files src/block.rs src/blockhandle.rs src/cache.rs src/filter_block.rs src/table_reader.rs
diffstat 5 files changed, 29 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/src/block.rs	Thu Jun 30 21:22:15 2022 -0700
+++ b/src/block.rs	Thu Jun 30 21:22:29 2022 -0700
@@ -193,16 +193,17 @@
 
         let current_off = self.current_entry_offset;
 
-        if let Some((shared, non_shared, _valsize, entry_head_len)) = self.parse_entry_and_advance() {
+        if let Some((shared, non_shared, _valsize, entry_head_len)) = self.parse_entry_and_advance()
+        {
             self.assemble_key(current_off + entry_head_len, shared, non_shared);
 
             // Adjust current_restart_ix
             let num_restarts = self.number_restarts();
             while self.current_restart_ix + 1 < num_restarts
                 && self.get_restart_point(self.current_restart_ix + 1) < self.current_entry_offset
-                {
-                    self.current_restart_ix += 1;
-                }
+            {
+                self.current_restart_ix += 1;
+            }
             true
         } else {
             #[cfg(debug_assertions)]
--- a/src/blockhandle.rs	Thu Jun 30 21:22:15 2022 -0700
+++ b/src/blockhandle.rs	Thu Jun 30 21:22:29 2022 -0700
@@ -22,8 +22,8 @@
                 offset: off,
                 size: sz,
             },
-            offsize + szsize)
-        )
+            offsize + szsize,
+        ))
     }
 
     pub fn new(offset: usize, size: usize) -> BlockHandle {
--- a/src/cache.rs	Thu Jun 30 21:22:15 2022 -0700
+++ b/src/cache.rs	Thu Jun 30 21:22:29 2022 -0700
@@ -69,9 +69,7 @@
         if self.count() == 0 {
             return None;
         }
-        let mut lasto = unsafe {
-                (*((*self.head.prev.unwrap()).prev.unwrap())).next.take()
-        };
+        let mut lasto = unsafe { (*((*self.head.prev.unwrap()).prev.unwrap())).next.take() };
 
         assert!(lasto.is_some());
         if let Some(ref mut last) = lasto {
--- a/src/filter_block.rs	Thu Jun 30 21:22:15 2022 -0700
+++ b/src/filter_block.rs	Thu Jun 30 21:22:29 2022 -0700
@@ -239,7 +239,9 @@
             for key in get_keys().iter() {
                 assert!(
                     reader.key_may_match(block_offset, key),
-                    "{} {:?} ", block_offset, key
+                    "{} {:?} ",
+                    block_offset,
+                    key
                 );
             }
             for key in unknown_keys.iter() {
--- a/src/table_reader.rs	Thu Jun 30 21:22:15 2022 -0700
+++ b/src/table_reader.rs	Thu Jun 30 21:22:29 2022 -0700
@@ -23,7 +23,10 @@
     f.read_at(size - table_builder::FULL_FOOTER_LENGTH, &mut buf)?;
     match Footer::decode(&buf) {
         Some(ok) => Ok(ok),
-        None => err(error::StatusCode::Corruption, &format!("Couldn't decode damaged footer {:?}", &buf))
+        None => err(
+            error::StatusCode::Corruption,
+            &format!("Couldn't decode damaged footer {:?}", &buf),
+        ),
     }
 }
 
@@ -80,8 +83,13 @@
         if let Some((_key, val)) = current_key_val(&metaindexiter) {
             let fbl = BlockHandle::decode(&val);
             let filter_block_location = match fbl {
-                None => return err(error::StatusCode::Corruption, &format!("Couldn't decode corrupt blockhandle {:?}", &val)),
-                Some(ok) => ok.0
+                None => {
+                    return err(
+                        error::StatusCode::Corruption,
+                        &format!("Couldn't decode corrupt blockhandle {:?}", &val),
+                    )
+                }
+                Some(ok) => ok.0,
             };
             if filter_block_location.size() > 0 {
                 return Ok(Some(table_block::read_filter_block(
@@ -244,8 +252,13 @@
     // Load the block at `handle` into `self.current_block`
     fn load_block(&mut self, handle: &[u8]) -> Result<()> {
         let (new_block_handle, _) = match BlockHandle::decode(handle) {
-            None => return err(error::StatusCode::Corruption, "Couldn't decode corrupt block handle"),
-            Some(ok) => ok
+            None => {
+                return err(
+                    error::StatusCode::Corruption,
+                    "Couldn't decode corrupt block handle",
+                )
+            }
+            Some(ok) => ok,
         };
         let block = self.table.read_block(&new_block_handle)?;