Mercurial > lbo > hg > leveldb-rs
changeset 489:0130b5d5e8c7
rustfmt
author | Lewin Bormann <lbo@spheniscida.de> |
---|---|
date | Fri, 30 Aug 2019 13:32:23 +0200 |
parents | b99076512068 |
children | 79244b94d102 |
files | src/benches/maps_bench.rs src/key_types.rs src/table_block.rs |
diffstat | 3 files changed, 16 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/benches/maps_bench.rs Fri Aug 30 13:31:39 2019 +0200 +++ b/src/benches/maps_bench.rs Fri Aug 30 13:32:23 2019 +0200 @@ -15,11 +15,7 @@ use std::collections::HashMap; use std::rc::Rc; -fn gen_key_val<R: Rng>( - gen: &mut R, - keylen: usize, - vallen: usize, -) -> (Vec<u8>, Vec<u8>) { +fn gen_key_val<R: Rng>(gen: &mut R, keylen: usize, vallen: usize) -> (Vec<u8>, Vec<u8>) { let mut key = Vec::with_capacity(keylen); let mut val = Vec::with_capacity(vallen);
--- a/src/key_types.rs Fri Aug 30 13:31:39 2019 +0200 +++ b/src/key_types.rs Fri Aug 30 13:32:23 2019 +0200 @@ -152,7 +152,11 @@ } /// cmp_memtable_key efficiently compares two memtable keys by only parsing what's actually needed. -pub fn cmp_memtable_key<'a, 'b>(ucmp: &dyn Cmp, a: MemtableKey<'a>, b: MemtableKey<'b>) -> Ordering { +pub fn cmp_memtable_key<'a, 'b>( + ucmp: &dyn Cmp, + a: MemtableKey<'a>, + b: MemtableKey<'b>, +) -> Ordering { let (alen, aoff): (usize, usize) = VarInt::decode_var(&a); let (blen, boff): (usize, usize) = VarInt::decode_var(&b); let userkey_a = &a[aoff..aoff + alen - 8]; @@ -185,7 +189,11 @@ /// cmp_internal_key efficiently compares keys in InternalKey format by only parsing the parts that /// are actually needed for a comparison. -pub fn cmp_internal_key<'a, 'b>(ucmp: &dyn Cmp, a: InternalKey<'a>, b: InternalKey<'b>) -> Ordering { +pub fn cmp_internal_key<'a, 'b>( + ucmp: &dyn Cmp, + a: InternalKey<'a>, + b: InternalKey<'b>, +) -> Ordering { match ucmp.cmp(&a[0..a.len() - 8], &b[0..b.len() - 8]) { Ordering::Less => Ordering::Less, Ordering::Greater => Ordering::Greater,
--- a/src/table_block.rs Fri Aug 30 13:31:39 2019 +0200 +++ b/src/table_block.rs Fri Aug 30 13:32:23 2019 +0200 @@ -37,7 +37,11 @@ /// Reads a table block from a random-access source. /// A table block consists of [bytes..., compress (1B), checksum (4B)]; the handle only refers to /// the location and length of [bytes...]. -pub fn read_table_block(opt: Options, f: &dyn RandomAccess, location: &BlockHandle) -> Result<Block> { +pub fn read_table_block( + opt: Options, + f: &dyn RandomAccess, + location: &BlockHandle, +) -> Result<Block> { // The block is denoted by offset and length in BlockHandle. A block in an encoded // table is followed by 1B compression type and 4B checksum. // The checksum refers to the compressed contents.