changeset 505:93a4d01c4000

all: rustfmt
author Lewin Bormann <lbo@spheniscida.de>
date Sun, 16 Feb 2020 11:32:13 +0100
parents e9ac2dccb9fd
children 81baad762dca
files src/benches/maps_bench.rs src/cache.rs src/log.rs src/table_block.rs src/table_reader.rs
diffstat 5 files changed, 13 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/src/benches/maps_bench.rs	Sun Feb 16 11:31:36 2020 +0100
+++ b/src/benches/maps_bench.rs	Sun Feb 16 11:32:13 2020 +0100
@@ -12,8 +12,8 @@
 use rusty_leveldb::DefaultCmp;
 use rusty_leveldb::SkipMap;
 
+use std::collections::BTreeMap;
 use std::collections::HashMap;
-use std::collections::BTreeMap;
 use std::rc::Rc;
 
 fn gen_key_val<R: Rng>(gen: &mut R, keylen: usize, vallen: usize) -> (Vec<u8>, Vec<u8>) {
--- a/src/cache.rs	Sun Feb 16 11:31:36 2020 +0100
+++ b/src/cache.rs	Sun Feb 16 11:32:13 2020 +0100
@@ -67,7 +67,7 @@
 
     fn remove_last(&mut self) -> Option<T> {
         if self.count() == 0 {
-            return None
+            return None;
         }
         if self.head.prev.is_some() {
             let mut lasto = unsafe {
--- a/src/log.rs	Sun Feb 16 11:31:36 2020 +0100
+++ b/src/log.rs	Sun Feb 16 11:32:13 2020 +0100
@@ -150,8 +150,7 @@
         loop {
             if self.blocksize - self.blk_off < HEADER_SIZE {
                 // skip to next block
-                self
-                    .src
+                self.src
                     .read(&mut self.head_scratch[0..self.blocksize - self.blk_off])?;
                 self.blk_off = 0;
             }
--- a/src/table_block.rs	Sun Feb 16 11:31:36 2020 +0100
+++ b/src/table_block.rs	Sun Feb 16 11:32:13 2020 +0100
@@ -50,15 +50,15 @@
         f,
         &BlockHandle::new(
             location.offset() + location.size(),
-            table_builder::TABLE_BLOCK_COMPRESS_LEN
-        )
+            table_builder::TABLE_BLOCK_COMPRESS_LEN,
+        ),
     )?;
     let cksum = read_bytes(
         f,
         &BlockHandle::new(
             location.offset() + location.size() + table_builder::TABLE_BLOCK_COMPRESS_LEN,
-            table_builder::TABLE_BLOCK_CKSUM_LEN
-        )
+            table_builder::TABLE_BLOCK_CKSUM_LEN,
+        ),
     )?;
 
     if !verify_table_block(&buf, compress[0], unmask_crc(u32::decode_fixed(&cksum))) {
--- a/src/table_reader.rs	Sun Feb 16 11:31:36 2020 +0100
+++ b/src/table_reader.rs	Sun Feb 16 11:32:13 2020 +0100
@@ -41,16 +41,10 @@
     /// Creates a new table reader operating on unformatted keys (i.e., UserKey).
     fn new_raw(opt: Options, file: Rc<Box<dyn RandomAccess>>, size: usize) -> Result<Table> {
         let footer = read_footer(file.as_ref().as_ref(), size)?;
-        let indexblock = table_block::read_table_block(
-            opt.clone(),
-            file.as_ref().as_ref(),
-            &footer.index
-        )?;
-        let metaindexblock = table_block::read_table_block(
-            opt.clone(),
-            file.as_ref().as_ref(),
-            &footer.meta_index
-        )?;
+        let indexblock =
+            table_block::read_table_block(opt.clone(), file.as_ref().as_ref(), &footer.index)?;
+        let metaindexblock =
+            table_block::read_table_block(opt.clone(), file.as_ref().as_ref(), &footer.meta_index)?;
 
         let filter_block_reader =
             Table::read_filter_block(&metaindexblock, file.as_ref().as_ref(), &opt)?;
@@ -126,11 +120,8 @@
         }
 
         // Two times as_ref(): First time to get a ref from Rc<>, then one from Box<>.
-        let b = table_block::read_table_block(
-            self.opt.clone(),
-            self.file.as_ref().as_ref(),
-            location
-        )?;
+        let b =
+            table_block::read_table_block(self.opt.clone(), self.file.as_ref().as_ref(), location)?;
 
         // insert a cheap copy (Rc).
         self.opt
@@ -756,5 +747,4 @@
             panic!("Should have hit 5th record in table!");
         }
     }
-
 }