Skip to content

Commit

Permalink
cargo fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Shih authored and Brian Shih committed Jan 3, 2024
1 parent 3ee0081 commit 1bb7401
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 18 deletions.
1 change: 0 additions & 1 deletion src/db/db_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,6 @@ mod test {

#[tokio::test]
async fn reading_its_txn_own_write() {
let foo = std::thread::available_parallelism().unwrap();
let db = DB::new_cleaned("./tmp/data", Timestamp::new(10));
db.run_txn(|txn_context| async move {
let key = "foo";
Expand Down
1 change: 0 additions & 1 deletion src/hlc/timestamp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ mod test {
fn compare_intent_timestamp() {
let first = Timestamp::intent_timestamp();
let second = Timestamp::new(12, 12);
let is_first_bigger = first > second;
assert!(first > second)
}

Expand Down
12 changes: 3 additions & 9 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ mod storage;
mod timestamp_oracle;
mod txn_wait;

use rocksdb::{DB};

use rocksdb::DB;

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct StorageError {
Expand Down Expand Up @@ -66,18 +65,13 @@ mod tests {

#[test]
fn test() {
let mvcc = Test { foo: true };
let str = serde_json::to_string(&mvcc).unwrap();
let meta = serde_json::from_str::<Test>(&str).unwrap();
let huh = "";

let test_bool = true;
let bool_str = serde_json::to_string(&test_bool).unwrap();
let meta = serde_json::from_str::<bool>(&bool_str).unwrap();
let _meta = serde_json::from_str::<bool>(&bool_str).unwrap();
// println!("value: {:?}", meta);

let vec = serde_json::to_vec(&test_bool).unwrap();
let back = serde_json::from_slice::<bool>(&vec).unwrap();
let _back = serde_json::from_slice::<bool>(&vec).unwrap();
// println!("value: {:?}", back);

let str = "foo";
Expand Down
2 changes: 1 addition & 1 deletion src/lock_table/lock_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ impl LockTable {
pub fn new_with_defaults() -> Self {
use tokio::sync::mpsc;

let (sender, receiver) = mpsc::channel::<TaskQueueRequest>(1);
let (sender, _receiver) = mpsc::channel::<TaskQueueRequest>(1);
LockTable {
locks: RwLock::new(HashMap::new()),
txn_map: Arc::new(RwLock::new(HashMap::new())),
Expand Down
2 changes: 1 addition & 1 deletion src/storage/mvcc_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ mod tests {
let txn = Txn::new_link(txn1_id, timestamp);

kv_store.create_pending_transaction_record(txn1_id, timestamp.to_owned());
let current_keys = kv_store.collect_all_mvcc_kvs();
let _current_keys = kv_store.collect_all_mvcc_kvs();

kv_store
.mvcc_put(str_to_key(key), None, Some(txn.clone()), 12)
Expand Down
6 changes: 3 additions & 3 deletions src/storage/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ mod Test {
}

mod storage_order {
use rocksdb::IteratorMode;


use crate::{
hlc::timestamp::Timestamp,
Expand All @@ -268,10 +268,10 @@ mod Test {
.unwrap();

let mut it = storage.get_mvcc_iterator();
let (k, v) = it.next().unwrap().unwrap();
let (k, _v) = it.next().unwrap().unwrap();
let key = MVCCIterator::convert_raw_key_to_mvcc_key(&k);
assert_eq!(key, second_mvcc_key);
let (second_k, v) = it.next().unwrap().unwrap();
let (second_k, _v) = it.next().unwrap().unwrap();
let second_key = MVCCIterator::convert_raw_key_to_mvcc_key(&second_k);
assert_eq!(second_key, first_mvcc_key);
}
Expand Down
4 changes: 2 additions & 2 deletions src/timestamp_oracle/oracle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ mod test {

#[test]
fn test_overlap() {
let mut oracle = TimestampOracle::new();
let oracle = TimestampOracle::new();
oracle.add(
Timestamp::new(3, 5),
str_to_key("apple"),
Expand All @@ -136,7 +136,7 @@ mod test {

#[test]
fn no_overlap() {
let mut oracle = TimestampOracle::new();
let oracle = TimestampOracle::new();
oracle.add(
Timestamp::new(3, 5),
str_to_key("apple"),
Expand Down

0 comments on commit 1bb7401

Please sign in to comment.