From 3916a06789323de0c2276efeef6912b0b539106e Mon Sep 17 00:00:00 2001 From: ngaut Date: Wed, 2 Mar 2016 11:28:27 +0800 Subject: [PATCH] *: Tiny clean up. --- src/comparator.rs | 24 ------------------------ src/merge_operator.rs | 2 ++ src/rocksdb.rs | 9 ++++----- 3 files changed, 6 insertions(+), 29 deletions(-) diff --git a/src/comparator.rs b/src/comparator.rs index 56edcd4..9229351 100644 --- a/src/comparator.rs +++ b/src/comparator.rs @@ -53,27 +53,3 @@ pub extern "C" fn compare_callback(raw_cb: *mut c_void, (cb.f)(a, b) } } - -fn test_reverse_compare(a: &[u8], b: &[u8]) -> c_int { - if a < b { - 1 - } else if a > b { - -1 - } else { - 0 - } -} - -// #[allow(dead_code)] -// #[test] -// fn compare_works() { -// let path = "_rust_rocksdb_comparetest"; -// let mut opts = Options::new(); -// opts.create_if_missing(true); -// opts.add_comparator("test comparator", test_reverse_compare); -// { -// let db = DB::open(&opts, path).unwrap(); -// // TODO add interesting test -// } -// assert!(DB::destroy(&opts, path).is_ok()); -// } diff --git a/src/merge_operator.rs b/src/merge_operator.rs index f747a8e..6d980b7 100644 --- a/src/merge_operator.rs +++ b/src/merge_operator.rs @@ -152,6 +152,8 @@ impl<'a> Iterator for &'a mut MergeOperands { } } +#[allow(unused_variables)] +#[allow(dead_code)] fn test_provided_merge(new_key: &[u8], existing_val: Option<&[u8]>, operands: &mut MergeOperands) diff --git a/src/rocksdb.rs b/src/rocksdb.rs index 5c2578b..66b5b08 100644 --- a/src/rocksdb.rs +++ b/src/rocksdb.rs @@ -818,6 +818,7 @@ impl ReadOptions { // TODO add snapshot setting here // TODO add snapshot wrapper structs with proper destructors; // that struct needs an "iterator" impl too. + #[allow(dead_code)] fn fill_cache(&mut self, v: bool) { unsafe { rocksdb_ffi::rocksdb_readoptions_set_fill_cache(self.inner, v); @@ -854,11 +855,9 @@ impl Drop for DBVector { impl DBVector { pub fn from_c(val: *mut u8, val_len: size_t) -> DBVector { - unsafe { - DBVector { - base: val, - len: val_len as usize, - } + DBVector { + base: val, + len: val_len as usize, } }